C++ Programming/Code/Standard C Library/Functions/setjmp

setjmp
The function setjmp stores the current execution status in env, and returns 0. The execution state includes basic information about which code is being executed in preparation for the longjmp function call. If and when longjmp is called, setjmp will return the parameter provided by longjmp - however, on the second return, variables that were modified after the initial setjmp call may have an undefined value.

The buffer is only valid until the calling function returns, even if it is declared statically.

Since setjmp does not understand constructors or destructors, it has been superseded with the C++ exception system, which uses the throw and catch keywords.


 * Related topics: longjmp