You actually have three mechanisms:
- C++ exceptions, implemented by the compiler (
try
/catch
) - Structured Exception Handling (SEH), provided by Windows (
__try
/__except
) - MFC exception macros (
TRY
,CATCH
– built on top of SEH / C++ exceptions – see also TheUndeadFish’s comment)
C++ exceptions usually guarantee automatic cleanup during stack unwinding (i.e. destructors of local objects run), the other mechanisms don’t.
C++ exceptions only occur when they are explicitly thrown. Structured Exceptions may occur for many operations, e.g. due to undefined behavior, passing invalid pointers to APIs, unmounting the backing store of a memory mapped file, and many more.
MFC did introduce the exception macros to support exceptions even if compilers didn’t implement them.