Re: [AD] 4.3 error handling

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On Thursday 08 June 2006 18:12, Peter Wang wrote:
> Found this in the info manual:
>
>    When you perform a non-local exit, accessible objects generally
> retain whatever values they had at the time `longjmp' was called.  The
> exception is that the values of automatic variables local to the
> function containing the `setjmp' call that have been changed since the
> call to `setjmp' are indeterminate, unless you have declared them
> `volatile'.

Non-static local variables are supposed to be on the stack, aren't they? 
According to the man page:

setjmp() saves the stack context/environment in env for later use by 
longjmp(). The stack context will be invalidated if the function which called 
setjmp() returns.

Which sounds to me like the local variables will be preserved /as long as/ the 
function that called setjmp doesn't return.. and since you don't prematurely 
exit a try block, and the end of the try block automatically clears the last 
setjmp point, this can't happen.




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/