Home | Overview | How Do I | FAQ
Do not use setjmp and longjmp in C++ programs; these functions do not support C++ object semantics. Also, using these functions in C++ programs may degrade performance by preventing optimization on local variables. Use the C++ exception handling try/catch constructs instead.
If you do use setjmp/longjmp in a C++ program, the interaction between these functions and C++ exception handling requires that you include SETJMP.H or SETJMPEX.H. Destructors for local objects will be called during the stack unwind if you compile with the /GX (Enable Exception Handling) option. Also, if you intend your code to be portable, do not rely on correct destruction of frame-based objects when executing a nonlocal goto using a call to longjmp.