Namespaces
Variants
Views
Actions

longjmp

From cppreference.com
< c‎ | program
Revision as of 22:40, 31 May 2013 by P12bot (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Defined in header <setjmp.h>
void longjmp( jmp_buf env, int status );

Loads the execution context env saved by a previous call to setjmp. This function does not return. Control is transferred to the call site of the macro setjmp that set up env. That setjmp then returns the value, passed as the status.

If the function that called setjmp has exited, the behavior is undefined (in other words, only long jumps up the call stack are allowed)

No destructors for automatic objects are called. If replacing of longjmp with throw and setjmp with catch would execute a non-trivial destructor for any automatic object, the behavior of such longjmp is undefined.

Contents

[edit] Parameters

env - variable referring to the execution state of the program saved by setjmp
status - the value to return from setjmp. If it is equal to 0, 1 is used instead

[edit] Return value

(none)

[edit] Example

[edit] See also

saves the context
(function macro) [edit]
C++ documentation for longjmp