INtime SDK Help

Saves the current context of the executing program and stores it in the specified location.

#include <setjmp.h>

int setjmp (jmp_buf context);


Structure in which the current context is stored.


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.

Return Values

0 (zero) after saving the context of the executing program. When setjmp returns as a result of a longjmp call, it returns the value argument of longjmp or returns 1 if the value argument of longjmp is 0.
No error return.


Versions Defined in Include Link to
INtime 3.0 intime/rt/include/setjmp.h setjmp.h clib.lib

See Also