stdlib.exit()

Jacob Carlborg doob at me.com
Mon Aug 20 08:04:44 PDT 2012


On 2012-08-20 16:27, bearophile wrote:
> Regan Heath:
>
>> 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.
>
> Seems OK.
> Another solution is to add a dexit() in Phobos :-)

Or the D runtime could just use the "atexit" function defined in 
stdlib.h. Just add a callback which terminates the D runtime.

http://pubs.opengroup.org/onlinepubs/009695299/functions/atexit.html

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list