Accessing memory after destroy

Temtaime via Digitalmars-d digitalmars-d at puremagic.com
Sun Jul 30 03:46:00 PDT 2017


On Sunday, 30 July 2017 at 07:58:19 UTC, ketmar wrote:
> Johan Engelen wrote:
>
>> [...]
>
> afair, somewhere in the spec there is a mention that dtor will 
> be called at most once for each initialized object. and object 
> state doesn't have any sense after calling dtor, but D still 
> has to put something there, so `.init` looks like a reasonable 
> choice. althru i'm not sure that anything in specs says that 
> runtime *must* clear destroyed objects (they aren't really 
> usable after calling dtor anyway, it is at least a logical bug 
> to use object after destroying it).

Seems that zeroing it out is better choice, maybe.


More information about the Digitalmars-d mailing list