
23 Mar
2010
23 Mar
'10
9:03 p.m.
Hi there,
I agree with Phil; that's undefined behaviour. I can't access the official C standard here, but in the C99 draft N1256 (http://www.open-std.org/jtc1/sc22/WG14/www/docs/n1256.pdf), in 7.13.2.1p2, it says (of longjmp):
... if the function containing the invocation of the setjmp macro has terminated execution in the interim, ... the behavior is undefined.
So, once try_something has returned, the effect of calls to longjmp is undefined.
Does that mean I have to call setjmp everytime before I call libjeg function? This way the function that calls setjmp would not have been terminated. Regards, Christian