Boost logo

Boost :

Subject: Re: [boost] [Block Pointer] Review Request
From: Emil Dotchevski (emildotchevski_at_[hidden])
Date: 2011-05-02 15:49:23


On Mon, May 2, 2011 at 12:19 PM, Phil Bouchard <philippe_at_[hidden]> wrote:
> On 5/2/2011 10:54 AM, Emil Dotchevski wrote:
>>
>> Yes but how do I know not to dereference it? Dereferencing a null
>> pointer is still undefined behavior.
>
> I was referring to the implicit destruction mechanism; the block_ptr will
> not be implicitly dereferenced if its pointee is already destroyed.
>
> If the pointer is explicitly dereferenced in the destructor then this will
> cause undefined behavior.

Then, what is the benefit of block_ptr compared to using raw pointers
as cyclic references? Maybe I'm missing something but aren't they
equally (un)safe?

Emil Dotchevski
Reverge Studios, Inc.
http://www.revergestudios.com/reblog/index.php?n=ReCode


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