Share via


Which Exception Handling Mechanism Should I Use?

OverviewHow Do IDetails

Visual C++ supports three different exception handling mechanisms. Use the one that fits your situation:

  • C++ exceptions

    The Visual C++  the Microsoft Foundation Class Library (MFC).

  • Structured exception handling

    Windows NT supplies its own exception mechanism, called structured exception handling (SEH). SEH is not recommended for C++ or MFC programming.

  • MFC exception macros

    MFC has, since MFC version 1.0, supported an exception handling mechanism exposed through a set of macros. Although use of these macros is not recommended for new programming, the macros are still supported for backward compatibility. In programs that already use the macros, you can freely use C++ exceptions as well — during preprocessing, the macros evaluate to the exception handling keywords defined in the Visual C++ implementation of the C++ language as of Visual C++ version 2.0. You can leave existing exception macros in place while you begin to use C++ exceptions.