Export (0) Print
Expand All

14.4 Unwinding

Visual Studio .NET 2003

The order of events for a thrown exception is as follows:

  1. The runtime walks the stack looking for the appropriate catch clause, or in the case of SEH, an except filter for SEH, to catch the exception. Catch clauses are searched first in lexical order, and then dynamically down the call stack.
  2. Once the correct handler is found, the stack is unwound to that point. For each function call on the stack, its local objects are destructed and __finally blocks are executed, from most nested outward.
  3. Once the stack is unwound, the catch clause is executed.
Show:
© 2014 Microsoft