Syntax of Structured Exceptions (C++)

From RAD Studio
Jump to: navigation, search

Go Up to Structured Exceptions Under Win32 (C++)

In a C program, the ANSI-compatible keywords used to implement structured exceptions are:

Note: The __try keyword can only appear in C programs. If you want to write portable code, do not use structured exception handling in your C++ programs.

try-except exception handling syntax

For try-except exception handling, the syntax is as follows:

try-block:

__try compound-statement (in a C module)
try compound-statement (in a C++module)

 handler:

__except (expression) compound-statement

try-finally termination syntax

For try-finally termination, the syntax is as follows:

try-block:

__try compound-statement (in a C module)
try compound-statement (in a C++module)

 termination:

__finally compound-statement

See Also

Retrieved from "https://docwiki.embarcadero.com/RADStudio/Tokyo/e/index.php?title=Syntax_of_Structured_Exceptions_(C%2B%2B)&oldid=250922"