Object destruction versus finalization

Dicebot public at dicebot.lv
Tue Nov 12 12:29:10 PST 2013


On Tuesday, 12 November 2013 at 20:15:02 UTC, Florian wrote:
> I played around a little and figured out, that destructors in D 
> work quite similarily to destructors in C++. They are invoked, 
> after the members of the instance being destructed have been 
> destroyed themselfes (or at least have been brought into an 
> invalid state). Therefore, these members cannot be accessed 
> savely from inside the destructor.

What made you think so? It must be other way around. Destructor 
is expected to release resources held by object, it is necessary 
that those resources are still valid at destructor call point. It 
would have been completely against the mode of operations of 
garbage collector.


More information about the Digitalmars-d-learn mailing list