KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q120921: Visual C++ Vers 2.0 README.WRI, Part 5 C++ Exception Handling

Article: Q120921
Product(s): Microsoft C Compiler
Version(s): 2.0
Operating System(s): 
Keyword(s): 
Last Modified: 29-JUL-2001

-------------------------------------------------------------------------------
The information in this article applies to:

- Microsoft Visual C++, version 2.0, on platform(s):
   - the hardware: Intel x86 
-------------------------------------------------------------------------------

SUMMARY
=======

The following is based on the Visual C++ version 2.0 README.WRI file:

Interaction Between setjmp/longjmp and C++ Exception Handling
-------------------------------------------------------------

The use of setjmp and longjmp is strongly discouraged in C++ programs. However,
if you use these functions and compile with the /GX option (Enable Exception
Handling), destructors for local objects will be called during the stack unwind.
Note that the use of setjmp and longjmp in C++ programs may degrade performance
by preventing optimization on local variables.

This interaction between setjmp/longjmp and C++ exception handling is supported
only when you include SETJMP.H or SETJMPEX.H.

If you are writing code that is intended to be portable, do not rely on correct
destruction of frame-based objects when executing a non-local goto using a call
to longjmp. The use of C++ exception handling try/catch constructs is
recommended in C++ programs instead of setjmp and longjmp.

Additional query words: 2.00

======================================================================
Keywords          :  
Technology        : kbVCsearch kbAudDeveloper
Version           : :2.0

=============================================================================

THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Copyright Microsoft Corporation 1986-2002.