lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


>>>>> "bel" == bel  <bel2125@gmail.com> writes:

 bel>   int result = setjmp(JUMP_TO_EXIT);
 bel>   if (result) {
 bel>       return result;
 bel>   }

Nitpick: this isn't actually legal code. A setjmp() call is allowed by
the specification only in certain highly restricted contexts (the entire
controlling expression of an if () or select (), or compared against an
integer constant or with ! in such an expression, or as a standalone
expression statement); any other use, including assigning the result to
a variable, is undefined.

This does mean that you can't use the return value from setjmp to convey
much information beyond the bare fact that longjmp was called; in
general you shouldn't try.

-- 
Andrew.