SETJMP(3spp) RISC/os Reference Manual SETJMP(3spp)
NAME
setjmp, longjmp - non-local goto
SYNOPSIS
#include <saio/setjmp.h>
void setjmp(env)
jmpbuf env;
void longjmp(env, val)
jmpbuf env;
int val;
DESCRIPTION
These routines are useful for dealing with errors and inter-
rupts encountered in a low-level subroutine of a program.
Setjmp saves its stack environment in env for later use by
longjmp. It returns value 0.
Longjmp restores the environment saved by the last call of
setjmp. It then returns in such a way that execution con-
tinues as if the call of setjmp had just returned the value
val to the function that invoked setjmp, which must not
itself have returned in the interim. If longjmp is called
from a fault handler, see nofault (3spp), the flow of con-
trol can be altered in a manner not visible to the compiler
system. In this case, all global and static variables that
can be updated between the setjmp and the longjmp, where
these updates must be visible after longjmp, should be
declared "volatile". If longjmp is not invoked from a fault
handler, this restriction is not necessary.
SEE ALSO
nofault(3spp)
Printed 1/6/92 Page 1