Everything

setjmp


Saves the execution environment of the currently executing function in the specified storage area.

[Format]

#include <setjmp.h>

long setjmp (jmp_buf env);

[Parameters]

env Pointer to storage area in which execution environment is to be saved

[Return values]

When setjmp function is called: 0

On return from longjmp function: Nonzero

[Remarks]

The execution environment saved by the setjmp function is used by the longjmp function. The return value is 0 when the function is called as the setjmp function, but the return value on return from the longjmp function is the value of the second parameter specified by the longjmp function.

If the setjmp function is called from a complex expression, part of the current execution environment, such as the intermediate result of expression evaluation, may be lost. The setjmp function should only be used in the form of a comparison between the result of the setjmp function and a constant expression, and should not be called within a complex expression.

Do not call the setjmp function indirectly using a pointer.