There are no notfications.


The setjmp.h header provides the means to bypass the normal function call and return discipline through nonlocal jumps whilst preserving the calling environment. This may be used to implemented exception handling and cooperative multitasking (coroutines). By contrast, the keyword goto performs local jumps.

Type aliases

Alias for an array
Contains information about the calling environment.


int setjmp(jmp_buf env);
Expands to an expression
Saves the calling environment to its env argument.
If the return is from a direct invocation, the macro returns 0. If the return is from a call to the longjmp function, the macro returns a nonzero value.


_Noreturn void longjmp(jmp_buf env, int val);
Restores the calling environment saved by the most recent invocation of the setjmp macro with the corresponding jmp_buf argument.
val is the value returned by the setjmp macro. If set to 0, then the function returns 1 in order to avoid undefined behaviour.

External links