D exit() function?

Krzysztof Szukiełojć krzysztof.szukielojc at gmail.com
Sun Mar 25 13:32:13 PDT 2007


Jarrett Billingsley wrote:

> I'm kind of dumbfounded.  I can't find any kind of D-compatible exit()
> function in phobos.  Using std.c.stdlib.exit will simply end the program,
> and module dtors/gc_term won't be called.  There's nothing in std.thread
> either.
> 
> Am I missing something?  Or is this something that should probably be
> added to phobos?

I think simple scope(exit) should do the trick.

void exitFun(){
 ...
}

void main(){
   scope(exit) exitFun();
   ... 
}



More information about the Digitalmars-d-learn mailing list