Boost logo

Boost :

Subject: Re: [boost] [afio] Formal review of Boost.AFIO
From: Niall Douglas (s_sourceforge_at_[hidden])
Date: 2015-09-01 19:02:06

On 31 Aug 2015 at 11:16, Glen Fernandes wrote:

> I see code like:
> ```
> auto buffer=std::make_shared<std::unique_ptr&lt;path::value_type[]>>(new
> path::value_type[buffersize]);
> ```
> Is this really what you intended? a shared_ptr<unique_ptr&lt;T[]> >? I would
> have thought you'd want shared_ptr<T[]> with one allocation instead of two.

As you have noticed, the v1.3 AFIO engine is beginning to show its
age, hence why I plan to reimplement it entirely.

Silly looking code like the above may be because I am loading all the
memory allocation into a place where it doesn't matter as much, and
then you decay the pointers as you nest into callbacks. It ain't
great, I am more than well aware of how much unnecessary memory
allocation occurs every AFIO operation (last time I checked: nine
mallocs and frees, really terrible), and the refactored engine with
ASIO removed should be greatly improved.

> Also, I noticed (when trying to get AFIO standalone working with ASIO
> standalone) that you check:
> ```
> ```
> Don't you mean #if !defined(ASIO_STANDALONE)? Most people just define
> ASIO_STANDALONE, not define it to a value like 1. What you have would be an
> error during compilation in that case.

Great catch! I had it in my head that ASIO needed ASIO_STANDALONE=1.
I just checked its config.hpp, and it's the presence which matters.
Logged at

Thanks for that one Glen, that's a big boo boo on my part.


ned Productions Limited Consulting

Boost list run by bdawes at, gregod at, cpdaniel at, john at