un-catched segfault exception

BCS BCS at pathlink.com
Thu Jan 10 10:05:15 PST 2008


Hxal wrote:
> 
> 
> I have played with throwing exceptions out of signal handlers and
> it's not going to work in a reliable way at all, on Linux at least.
> The compiler doesn't generate exception handling frames for blocks
> of code it doesn't expect to throw an exception, and it doesn't
> expect single instructions to do so.

I uses this approach and it works just fine. (DMD/Linux and IIRC DMD/Win)

> 
> PS. Throwing exceptions across C code aborts too, you can however
> add one of the previously mentioned flags when compiling C code.
> 

I've never seen this.

  OTOH I don't actually catch the exception as the only thing I actually 
uses the exception for is a poor man's stack trace:

// add this at the top of all functions.
scope(failure) writef(">>"__FILE__":"~itoa!(__LINE__)~\n);



More information about the Digitalmars-d mailing list