Training
×

Structured Exception Handling

Structured Exception handling is a Microsoft specific extension to the C programming language, implemented by Microsoft Visual Studio. It allows a C program to deal with hardware, and starting with INtime 6: numeric exceptions, in a structured way. Floating Point exceptions must be enabled to be included.
A block of code is enclosed in “__try{“ and “}” and then followed by an __except block.
If an exception occurs in the try block, the filter expression in the except block is evaluated and as a result the except block is further executed or an embracing except block is tried.
If a try block is successfully executed or if an except block is executed, execution continues after the try-except sequence.
The finally option makes sure that no matter how the try block finishes, the code in the finally block is always executed. A try block can only have one except or finally block, but they can be nested as required.
Self-raised exceptions are generated by the RaiseException function. RaiseException enables a process to use structured exception handling to handle private, software-generated and application-defined exceptions.