
2 May
2011
2 May
'11
7:49 p.m.
On Mon, May 2, 2011 at 12:19 PM, Phil Bouchard <philippe@fornux.com> 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