The <setjmp.h>
header file contains declarations that
provide a way to avoid the normal function call and return sequence,
typically to permit an intermediate return from a nested function
call.
int setjmp(jmp_buf env)
jmp_buf
buffer and
initializes it for the jump (the jump itself is performed
with longjmp
.) This macro saves the program's
calling environment in the environment buffer specified by the
env argument for later use by the longjmp
function. If the return is from a direct invocation,
setjmp
returns 0. If the return is from a call to
longjmp
, setjmp
returns a nonzero
value.
jmp_buf
void longjmp(jmp_buf env, int value;)
setjmp
function
in the same invocation of the program. The longjmp
function does not work if called from a nested signal handler;
the result is undefined.
The value specified by value is passed from
longjmp
to setjmp
. After
longjmp
is completed, program execution continues
as if the corresponding invocation of setjmp
had
just returned value. If value is passed to
setjmp
as 0, it is converted to 1.