dereferencing null

Michel Fortin michel.fortin at michelf.com
Tue Mar 6 05:26:14 PST 2012


On 2012-03-06 10:53:19 +0000, Jacob Carlborg <doob at me.com> said:

> On Mac OS X the runtime would only need to catch any exception (as it 
> already does) and print the stack trace. But also re-throw the 
> exception to let the OS handle the logging of the exception (at least I 
> hope that will work).

Actually if you want a useful crash log the exception shouldn't be 
caught at all, because reaching the catch handler requires unwinding 
the stack which will ruin the stack trace for the log file. Printing 
the stack trace should be done in the exception handling code if no 
catch handler can be found, after which it can crash and let the OS do 
its thing. And for that to work there should be no catch block around 
the call to D main in the runtime initialization code.

-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/



More information about the Digitalmars-d mailing list