(e-mail address removed) (Mantorok Redgormor) wrote in
is there a portable way of implementing exception handling with
setjmp, longjmp?
restoring the state of a program and such really seems like I am
asking for undefined behavior.
The only state of the program which is not preserved by longjmping are
automatic variables IIRC. I wrote a toy exception handling 'thing' a long
time ago in here which exploited that fact. You had to specifically
preserve the automatic variables you wanted to keep (and you could keep
them at stages in the 'try' block), but it was all very much a hack.
I'll try and have a dig around and see if I still have it. If not, I might
just rewrite it for laughs.
Ian Woods