# fnon-call-exceptions

Allows trapping instructions to throw C++ exceptions.

## Syntax

Linux and macOS: | -fnon-call-exceptions -fno-non-call-exceptions

Windows: | None

## Arguments

None

## Default

-fno-non-call-exceptions | C++ exceptions are not thrown from trapping instructions.

## Description

This option allows trapping instructions to throw C++ exceptions. It allows hardware signals generated by trapping instructions to be converted into C++ exceptions and caught using the standard C++ exception handling mechanism. Examples of such signals are SIGFPE (floating-point exception) and SIGSEGV (segmentation violation).

You must write a signal handler that catches the signal and throws a C++ exception. After that, any occurrence of that signal within a C++ try block can be caught by a C++ catch handler of the same type as the C++ exception thrown within the signal handler.

Only signals generated by trapping instructions (that is, memory access instructions and floating-point instructions) can be caught. Signals that can occur at any time, such as SIGALRM, cannot be caught in this manner.

## IDE Equivalent

None

## Alternate Options

None

Parent topic: Compiler Diagnostic Options