Issue with module destructor order

Kevin Cox kevincox.ca at gmail.com
Sun Apr 8 05:14:18 PDT 2012


On Mar 26, 2012 5:11 AM, "Benjamin Thaut" <code at benjamin-thaut.de> wrote:
> Is this intended behaviour or is this a bug? I assume this happens
because of the mixin template and the public import.
> I'm using dmd 2.058.
>
> --
> Kind Regards
> Benjamin Thaut

I don't think the order of destructors is defined. There would be no way to
have semantic control because it wouldn't work when you link different
files together.  The only solution would be to have the compiler analyse
the code and figure out what should be destructed first which would be and
impressive feat.

The solution to solving your problem is not to close the file object in the
destructor and let the OS clean it up when your program terminates.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20120408/5f6f689b/attachment.html>


More information about the Digitalmars-d mailing list