Compartilhar via


AbnormalTermination

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

This function indicates whether the try block of a try-finally statement terminated normally.

This function can be called only from within the finally block of a try-finally statement.

Syntax

BOOL AbnormalTermination(void);

Parameters

None.

Return Value

Nonzero indicates that the try block of the try-finally statement terminated abnormally. Zero indicates that the try block of the try-finally statement terminated normally.

Remarks

The Excpt.h file must be explicitly included to use this function.

The try block terminates normally only if the execution process leaves the block sequentially after running the last statement in the block.

Statements (such as return, goto, continue, or break) that cause the process to leave the try block abnormally terminate the block. This occurs even if such a statement is the last statement in the try block.

When a try block terminates abnormally, it causes the system to search all stack frames to determine whether termination handlers must be called. This search can cause hundreds of instructions to run, so it is important to avoid abnormally terminating a try block due to a return, goto, continue, or break statement.

These statements do not generate an exception, even though the termination is abnormal.

To avoid abnormally terminating the try-finally block, the process should continue to the end of the block.

You can also run the leave statement. The leave statement immediately terminates the try block without abnormally terminating and compromising performance.

To determine whether the leave statement is supported check your compiler documentation.

Requirements

Header excpt.h
Library coredll.lib
Windows Embedded CE Windows CE 1.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also

Reference

Exception Functions