Difference between revisions of "cpp/utility/program/longjmp"
From cppreference.com
m (+example etc) |
(+explicit restrictions) |
||
Line 5: | Line 5: | ||
}} | }} | ||
− | Loads the execution context {{tt|env}} saved by a previous call to {{cpp|setjmp}}. This function does not return. Control is transferred to the | + | Loads the execution context {{tt|env}} saved by a previous call to {{cpp|setjmp}}. This function does not return. Control is transferred to the call site of the macro {{cpp|setjmp}} that set up {{tt|env}}. That {{cpp|setjmp}} then returns the value, passed as the {{tt|status}}. |
− | No | + | If the function that called {{cpp|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 {{tt|std::longjmp}} with {{cpp|throw}} and {{cpp|setjmp}} with {{cpp|catch}} would execute a non-trivial destructor for any automatic object, the behavior of such {{cpp|std::longjmp}} is undefined. | ||
===Parameters=== | ===Parameters=== |
Revision as of 12:16, 8 November 2011
Template:cpp/utility/program/sidebar
Defined in header <csetjmp>
|
||
void longjmp( std::jmp_buf env, int status ); |
||
Loads the execution context env
saved by a previous call to Template:cpp. This function does not return. Control is transferred to the call site of the macro Template:cpp that set up env
. That Template:cpp then returns the value, passed as the status
.
If the function that called Template:cpp 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 std::longjmp
with Template:cpp and Template:cpp with Template:cpp would execute a non-trivial destructor for any automatic object, the behavior of such Template:cpp is undefined.
Contents |
Parameters
env | - | variable referring to the execution state of the program saved by Template:cpp |
status | - | the value to return from Template:cpp. If it is equal to Template:cpp, Template:cpp is used instead |
Return value
(none)
Example
See also
saves the context (function macro) |