When setjmp is first called, it returns the value 0. If longjmp
is then called, naming the same environment as the call to
setjmp, control is returned to the setjmp call as if it had
returned normally a second time. The return value of setjmp in
this second return is the value supplied by you in the longjmp
call. To preserve the true value of setjmp, the function calling
setjmp must not be called again until the associated longjmp is
called.
The setjmp function preserves the hardware general-purpose
registers, and the longjmp function restores them. After a
longjmp, all variables have their values as of the time of the
longjmp except for local automatic variables not marked volatile.
These variables have indeterminate values.
The setjmp and longjmp functions rely on the OpenVMS
condition-handling facility to effect a nonlocal goto with
a signal handler. The longjmp function is implemented by
generating a Compaq C RTL specified signal that allows the
OpenVMS condition-handling facility to unwind back to the desired
destination.
The Compaq C RTL must be in control of signal handling for any
Compaq C image. For Compaq C to be in control of signal handling,
you must establish all exception handlers through a call to the
VAXC$ESTABLISH function.
NOTE
The C RTL provides nonstandard decc$setjmp and decc$fast_
longjmp functions for Alpha and Integrity server systems. To
use these nonstandard functions instead of the standard
ones, a program must be compiled with __FAST_SETJMP or
__UNIX_SETJMP macros defined.
Unlike the standard longjmp function, the decc$fast_longjmp
function does not convert its second argument from 0 to 1.
After a call to decc$fast_longjmp, a corresponding setjmp
function returns with the exact value of the second argument
specified in the decc$fast_longjmp call.