### Windows Default Exception Handling

The IBM C and C++ Compilers library provides a default exception handling function, _Exception. This function is the C language exception handler. By default, _Exception is registered automatically for every process or thread launched by functions provided by IBM C and C++ Compilers. The default handler maps recognized Windows exceptions to C signals, which are then passed by the run-time library to the appropriate signal handlers.

The table below shows which types of Windows exceptions are recognized by _Exception, the names of the exceptions, and the C signals to which each exception type is mapped. These are the only OS/2 exceptions handled by _Exception. The table also shows whether the program can continue if the corresponding signal handler is SIG_IGN or if a user-defined signal handler returns. A No means that the program terminates unless the signal has a handler that calls longjmp to jump to transfer control.

If the signal handler value is set to SIG_DFL, the default action taken for each of these exceptions is to terminate the program with an exit code of 99.

Windows Exception | C Signal | Continuable?
--- | --- | ---
Divide by zero EXCEPTION_INT_DIVIDE_BY_ZERO | SIGFPE | No
NPX387 error EXCEPTION_FLOAT_DENORMAL_OPERAND EXCEPTION_FLT_DIVIDE_BY_ZERO EXCEPTION_FLT_INEXACT_RESULT EXCEPTION_FLT_INVALID_OPERATION EXCEPTION_FLT_OVERFLOW EXCEPTION_FLT_STACK_CHECK EXCEPTION_FLT_UNDERFLOW | SIGFPE | No; except for EXCEPTION_FLT_INEXACT_RESULT
Overflow occurred EXCEPTION_INT_OVERFLOW This exception is never caused by code generated by IBM C and C++ Compilers. | SIGFPE | Yes; resets the overflow flag
Bound opcode failed EXCEPTION_ARRAY_BOUNDS_EXCEEDED This exceptions is never caused by code generated by IBM C and C++ Compilers. | SIGFPE | No
Opcode not valid EXCEPTION_ILLEGAL_INSTRUCTION EXCEPTION_PRIVILEGED_INSTRUCTION | SIGILL | No
General Protection fault EXCEPTION_ACCESS_VIOLATION EXCEPTION_DATATYPE_MISALIGNMENT | SIGSEGV | No
Ctrl-Break CTRL_BREAK_EVENT | SIGBREAK | Yes
Ctrl-C CTRL_C_EVENT | SIGINT | Yes
End process CTRL_CLOSE_EVENT | SIGTERM | Yes

Signals and Exceptions
Handling Signals and Exceptions
Using Exception Handlers in Multi-Thread Programs
Using Signal and Exception Handlers in DLLs

Handle Floating-Point Exceptions
Write or Register an Exception Handler

Asynchronous Exceptions
Signals and Default Handlers