Boost logo

Boost :

Subject: Re: [boost] [afio] Formal review of Boost.AFIO
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2015-08-31 15:53:46


On 31.08.2015 20:08, Niall Douglas wrote:
>
> I would like to once again reiterate that AFIO exposes its use of
> shared_ptr as afio::handle_ptr. You, the AFIO end user, need not
> concern yourself with what kind of pointer handle_ptr is. You simply
> need to accept that it behaves like any smart pointer. I might change
> afio::handle_ptr to be something else at some future point, and your
> code need not concern itself about that.

Not true. There is no "any smart pointer". The semantics of a pointer is
defined by its ownership model. You can't copy a unique_ptr, for
instance. You can't expect that copying a shared_ptr copies the pointee.
You can't be sure a weak_ptr refers to an object, even if it did a
moment ago. And so on.

The fact that most shared_ptr implementations are based on reference
counting is a completely irrelevant implementation detail. For all I
know it could be using GC under the hood.

Did you document your handle_ptr somewhere? By document I mean including
the ownership model, thread safety, operations semantics and so on.
Because when you decide to change it to something different you'll have
to support the same semantics as before. And even if you don't, users
still have to understand what kind of pointer this is.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk