|
Boost : |
From: David Abrahams (dave_at_[hidden])
Date: 2003-01-07 18:02:55
"Peter Dimov" <pdimov_at_[hidden]> writes:
> From: "David Abrahams" <dave_at_[hidden]>
>>
>> Yes, but IIUC the reason the library's not doing it is because you
>> might get the order wrong, which could cause a problem like a dangling
>> pointer needed for some destructor.
>
> Not really... The library's not currently doing it because it hasn't been my
> goal to provide a "real" garbage collected pointer. sp_debug_hooks.cpp is an
> example that demonstrates what can be done with the debug hooks called by
> shared_ptr; code using it operates in "safe mode" (or slightly safer mode.)
> IOW a shared_ptr cycle is still not supposed to happen in bug free programs.
>
> That aside, can you think of a reasonable design that does not depend on
> intentionally created shared_ptr cycles, but still needs a correct
> destruction order when a cycle is broken?
I can barely think of a reasonable design where GC is a big design win
;-)
In my work, ownership relationships are usually very obvious. When
they're not, destruction does nothing but release resources.
-- David Abrahams dave_at_[hidden] * http://www.boost-consulting.com Boost support, enhancements, training, and commercial distribution
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk