devxlogo

Structured Exception Handling and Standard Exception Handling

Structured Exception Handling and Standard Exception Handling

Many C compilers provide a non-standard feature called “structured exception handling”, or SEH for short. SEH can trap asynchronous, platform-specific exceptions such as division by zero, floating point overflow and underflow, and other hardware exceptions. In contrast, the standard C++ exception handling (EH) applies only to synchronous exceptions, i.e., exceptions that are generated by the program itself, and which are explicitly created by a throw statement.

The type of exceptions raised by SEH and EH, as well as their underlying mechanisms and recovery methods, are incompatible. Therefore, never confuse SEH with EH, or vice versa. In C, use SEH if necessary. In C++, stick to EH exclusively.

devx-admin

Share the Post: