none
TRY...CATCH RRS feed

Answers

  • I do not thing there is such a macro (see the other macros in afx.h file). There is a recommendation to use C++ mechanism instead [http://msdn.microsoft.com/en-us/library/t078xe4f(VS.80).aspx]. Therefore use try-catch-finally blocks. (See also: __finally keyword).
    • Marked as answer by Nancy Shao Monday, August 24, 2009 2:18 AM
    Monday, August 17, 2009 12:02 PM
  • C++ does not need FINALLY concept, because properly designed C++ classes clean up their resources in their destructor. The destructor is always called, regardless of whether an exception is thrown. Read about the RAII paradigm, here for example:

    http://en.wikipedia.org/wiki/RAII

    IMHO, RAII is one of the most elegant features of standard C++, and it is a great pity that it was not properly implemented in the CLR.

    By the way, I would advise the use of standard C++ try, catch rather than MFC TRY, CATCH.

    David Wilkinson | Visual C++ MVP
    • Marked as answer by Nancy Shao Monday, August 24, 2009 2:18 AM
    Monday, August 17, 2009 12:06 PM

All replies

  • I do not thing there is such a macro (see the other macros in afx.h file). There is a recommendation to use C++ mechanism instead [http://msdn.microsoft.com/en-us/library/t078xe4f(VS.80).aspx]. Therefore use try-catch-finally blocks. (See also: __finally keyword).
    • Marked as answer by Nancy Shao Monday, August 24, 2009 2:18 AM
    Monday, August 17, 2009 12:02 PM
  • C++ does not need FINALLY concept, because properly designed C++ classes clean up their resources in their destructor. The destructor is always called, regardless of whether an exception is thrown. Read about the RAII paradigm, here for example:

    http://en.wikipedia.org/wiki/RAII

    IMHO, RAII is one of the most elegant features of standard C++, and it is a great pity that it was not properly implemented in the CLR.

    By the way, I would advise the use of standard C++ try, catch rather than MFC TRY, CATCH.

    David Wilkinson | Visual C++ MVP
    • Marked as answer by Nancy Shao Monday, August 24, 2009 2:18 AM
    Monday, August 17, 2009 12:06 PM