forcing "@nogc" on class destructors

via Digitalmars-d digitalmars-d at puremagic.com
Sat Jan 24 07:04:46 PST 2015


On Saturday, 24 January 2015 at 00:31:48 UTC, Paolo Invernizzi 
wrote:
>> But my real point is that depending on dtors being called by 
>> the GC is not broken 90% of the time.
>>
>> -Steve
>
> You are right, on a literal point, but I think that what he was

If the classes are written for RAII then the destructors have to 
be called in reverse order of the constructors. IIRC D does not 
guarantee this when you use the GC.

So to do it right there is a lot of GC overhead.

> be appropriate: it's a very common pitfall, and a pitfall that
> simply cast a bad light on the language in newcomers' minds when
> it occurs at runtime.

Yes:

https://www.google.no/search?q=InvalidMemoryOperationError


More information about the Digitalmars-d mailing list