std::set_jmp

From Cppreference

Jump to: navigation, search
Defined in header <csetjmp>

int setjmp( jmp_buf env );

Saves the current execution context into a variable env. This variable can later be used to restore the current execution context by longjmp() function. That is, when a call to longjmp() function is made, the execution continues at the particular call site that constructed the jmp_buf variable passed to longjmp(). In that case setjmp() returns tho value passed to longjmp().

setjmp() may be implemented as a macro.

Contents

[edit] Parameters

env - variable to save the execution state of the program to.

.

[edit] Return value

0 if the function was called by the original code and the execution context was saved to env.

Non-zero value if a non-local jump was just performed. The return value in the same as passed to longjmp().

[edit] Example

[edit] See also

longjmp
jumps to specified location
(function)