Saves the current context of the executing program and stores it in the specified location.
#include <setjmp.h> int setjmp (jmp_buf context);
context
The JMP_BUF structure is usable only as an argument for the subsequent longjmp call; JMP_BUF is defined internally to the C library.
Used together, setjmp and longjmp provide a way to execute a nonlocal goto. They typically pass execution control to error-handling or recovery code in a previously called routine without using the normal calling or return conventions.
A subsequent call to longjmp restores the context and resumes execution at the point setjmp was called. All local variables except register variables, accessible to the routine receiving control, contain the values they had when setjmp was called. Global variables are unaffected.
Versions | Defined in | Include | Link to |
---|---|---|---|
INtime 3.0 | intime/rt/include/setjmp.h | setjmp.h | clib.lib |