## Working with C++ Exceptions

If you enable the Enable C++ Exceptions setting , you can use the try and catch statements to perform exception handling. For more information on activating support for C++ exception handling, see “Controlling Exception Handling”.

Enabling exceptions lets you throw them across any code compiled by the Carbide C/C++ compiler. However, you cannot throw exceptions across the following:

- Libraries compiled with exception support disabled
- Libraries compiled with versions of the Carbide C/C++ compiler earlier than v3.4

If you throw an exception across one of these, the code calls terminate() and exits.

If you throw an exception while allocating a class object or an array of class objects, the code automatically destructs the partially constructed objects and de-allocates the memory for them.