close program by code

Chris Nicholson-Sauls via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jun 26 06:23:17 PDT 2014


On Thursday, 26 June 2014 at 11:07:37 UTC, Rene Zwanenburg wrote:
>
> They won't. Same for module destructors.
>
> If you need those to work, another option is to throw some 
> custom Exception type which is only caught in main.

I really wish this wasn't the answer, but for some programs I've 
had to resort to it myself.  For at least one I've defined an 
Exception type that carries a status code payload to be returned 
by main.  D needs its own exit().

There's been this request in the bugzilla since 2009:
https://issues.dlang.org/show_bug.cgi?id=3462


More information about the Digitalmars-d-learn mailing list