Secure Coding mailing list archives

Coding with errors in mind - a solution?


From: mouse at Rodents.Montreal.QC.CA (der Mouse)
Date: Tue, 5 Sep 2006 14:50:46 -0400 (EDT)

if an exception is handled several call layers above, you don't have
to copy/translate and relay the error at each layer, [...]
But the intervening stack frames have to be (painfully) aware of the
fact that they might terminate abruptly.

That's what unwind-protect is for.

What, you don't have unwind-protect?  Perhaps you need to fix that
first. :-)

Actually, I have found it not all that difficult.  I have (ab?)used
gcc's nested-function nonlocal-goto support as an error-handling
throw facility relatively often, and I've run into very few cases where
intervening stack frames have to be aware of the throw-through-them
potential, and none where I would say it was painful.  Perhaps that's
just an artifact of how I design my code....

/~\ The ASCII                           der Mouse
\ / Ribbon Campaign
 X  Against HTML               mouse at rodents.montreal.qc.ca
/ \ Email!           7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B


Current thread: