Destructor/Finalizer Guarantees
thedeemon via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Nov 12 03:47:03 PST 2014
On Tuesday, 11 November 2014 at 22:31:17 UTC, Maxime
Chevalier-Boisvert wrote:
> I've made it so they unregister themselves in their destructor.
> ... However, this only works if I can assume that the GC will
> first call the destructor on an object, then free the object,
> that this is done in a predictable order.
This order is not really predictable now. In general in
destructor you can't access anything outside the object's value
typed fields. Any reference may point to a dead object at this
moment, any external or global object may be destroyed already.
More information about the Digitalmars-d-learn
mailing list