setjmp(3C)
_________________________________________________________________
setjmp $builtin function
Provide for nonlocal flow of control.
_________________________________________________________________
Calling Sequence
#include <setjmp.h>
jmpbuf save; /* Macro in setjmp.h */
setjmp(&save);
(or)
$builtin int setjmp();
jmpbuf save;
setjmp(&save);
Description
The setjmp function provides for nonlocal flow of control. It
sets the conditions for performing a goto to a procedure nested
at an arbitrary depth. In order to set up the return address,
which is the instruction following the location of setjmp, you
must call setjmp before using longjmp to perform the jump.
The first version in the calling sequence section above uses a
function call. The second might generate smaller or faster code,
but might not run under other C compilers. The include file
setjmp.h defines this entry, and uses the $builtin version.
Returns
On initial invocation, setjmp returns 0. When longjmp is called,
setjmp appears to return the value specified in the longjmp call
(execution restarts at the setjmp statement).
Related Functions
See also the longjmp function, described in this chapter, and the
mlongjmp function, described in Chapter 3 of Using Specialized C
Functions.
Example
See the example for the longjmp function.
DG/UX 4.00 Page 1
Licensed material--property of copyright holder(s)