stdlib.exit()

Regan Heath regan at netmail.co.nz
Mon Aug 20 07:18:52 PDT 2012


On Mon, 20 Aug 2012 10:03:56 +0100, David <d at dav1d.de> wrote:

> Am 20.08.2012 09:15, schrieb Tracey:
>> I use the following:
>>
>> import std.c.stdlib;
>> exit(0);
>>
>
> Yeah, but that doesn't terminate the runtime and will not call any  
> dtors, right?

std.c.stdlib.exit is the C runtime exit function which doesn't know  
anything about D's runtime, which is layered on top.  So, I would not  
expect any D runtime cleanup to occur.

You could define a custom ExitException and throw that, catching it at the  
top level and returning the error code stored inside it, from main().  Not  
ideal, but it would work.

R

-- 
Using Opera's revolutionary email client: http://www.opera.com/mail/


More information about the Digitalmars-d-learn mailing list