[Exceptional C++ Style] Item 12: Exception Safety: Is itWort hit?

Kevlin Henney kevlin at curbralan.com
Fri Dec 3 07:23:38 EST 2004


In message 
<20041203105512.MPVJ1113.aamta03-winn.mailhost.ntl.com@[62.253.162.64]>, 
Ric Parkin <ric.parkin at ntlworld.com> writes
>
>Hmmm, is one way to have a signal handler and throw an exception from 
>that? I know that's rather naughty, but we're deep into specifics 
>anyway.

So naughty that some systems crash when you do it :->

I remember trying this out on one platform (Ultrix) many years ago (as 
you might guess from the OS) and it worked, so I promptly tried it out 
on another (OSF/1, which became Digital Unix, which became Tru64) to 
check for de facto portability: it crashed. The exception actually 
missed main: signal handlers are not necessarily executed on the same 
stack as the thread they originated in, so unwinding in the hope you 
reach main may well prove fruitless.

And then, eventually, the standard came out and confirmed that is was a 
definite no-no.

Kevlin
-- 
____________________________________________________________

   Kevlin Henney                   phone:  +44 117 942 2990
   mailto:kevlin at curbralan.com     mobile: +44 7801 073 508
   http://www.curbralan.com        fax:    +44 870 052 2289
   Curbralan: Consultancy + Training + Development + Review
____________________________________________________________



More information about the Effective-cpp mailing list