AbnormalTermination macro

Indicates whether the __try block of a termination handler terminated normally. The function can be called only from within the __finally block of a termination handler.


The Microsoft C/C++ Optimizing Compiler interprets this function as a keyword, and its use outside the appropriate exception-handling syntax generates a compiler error.


BOOL AbnormalTermination(void);


This macro has no parameters.

Return value

If the __try block terminated abnormally, the return value is nonzero.

If the __try block terminated normally, the return value is zero.


The __try block terminates normally only if execution leaves the block sequentially after executing the last statement in the block. Statements (such as return, goto, continue, or break) that cause execution to leave the __try block result in abnormal termination of the block. This is the case even if such a statement is the last statement in the __try block.

Abnormal termination of a __try block causes the system to search backward through all stack frames to determine whether any termination handlers must be called. This can result in the execution of hundreds of instructions, so it is important to avoid abnormal termination of a __try block due to a return, goto, continue, or break statement. Note that these statements do not generate an exception, even though the termination is abnormal.

To avoid abnormal termination, execution should continue to the end of the block. You can also execute the __leave statement. The __leave statement allows for immediate termination of the __try block without causing abnormal termination and its performance penalty. Check your compiler documentation to determine if the __leave statement is supported.


Requirement Value
Minimum supported client
Windows XP [desktop apps only]
Minimum supported server
Windows Server 2003 [desktop apps only]

See also

Structured Exception Handling Functions

Structured Exception Handling Overview