Destructor called while object is still alive

frame frame86 at live.com
Sat Oct 24 09:02:41 UTC 2020


On Saturday, 24 October 2020 at 06:35:00 UTC, Kagamin wrote:
> On Friday, 23 October 2020 at 19:23:03 UTC, frame wrote:
>> So how can I avoid this issue with DMD? Disabling any 
>> optimization?
>
> You avoid it by correctly designing your code. Resource 
> management with class destructors is incorrect design.

Yeah, I understand but this doesn't help if resources are wiped 
when the object gets destroyed too. I have no problem with that 
GC may not call the destructor - I have a problem if the GC call 
the destructor out of the wild. It's also ok that the 
optimizations are done in my point of view but as a newbie, for 
me this should be well documented somewhere.





More information about the Digitalmars-d mailing list