For the latest documentation on Visual Studio 2017 RC, see Visual Studio 2017 RC Documentation.
Restores stack environment and execution locale.
void longjmp( jmp_buf env, int value );
Variable in which environment is stored.
Value to be returned to
longjmp function restores a stack environment and execution locale previously saved in
longjmp provide a way to execute a nonlocal
goto; they are typically used to pass execution control to error-handling or recovery code in a previously called routine without using the normal call and return conventions.
A call to
setjmp causes the current stack environment to be saved in
env. A subsequent call to
longjmp restores the saved environment and returns control to the point immediately following the corresponding
setjmp call. Execution resumes as if value had just been returned by the
setjmp call. The values of all variables (except register variables) that are accessible to the routine receiving control contain the values they had when
longjmp was called. The values of register variables are unpredictable. The value returned by
setjmp must be nonzero. If value is passed as 0, the value 1 is substituted in the actual return.
longjmp before the function that called
setjmp returns; otherwise the results are unpredictable.
Observe the following restrictions when using
Do not assume that the values of the register variables will remain the same. The values of register variables in the routine calling
setjmpmay not be restored to the proper values after
Do not use
longjmpto transfer control out of an interrupt-handling routine unless the interrupt is caused by a floating-point exception. In this case, a program may return from an interrupt handler via
longjmpif it first reinitializes the floating-point math package by calling
Note Be careful when using
longjmpin C++ programs. Because these functions do not support C++ object semantics, it is safer to use the C++ exception-handling mechanism.
For more information, see Using setjmp and longjmp.
For additional compatibility information, see Compatibility in the Introduction.
All versions of the C run-time libraries.
See the example for _fpreset.
Not applicable. To call the standard C function, use
PInvoke. For more information, see Platform Invoke Examples.