Go to main content
Oracle® Developer Studio 12.6: C++ User's Guide

Exit Print View

Updated: July 2017
 
 

8.3 Disabling Exceptions

If you know that exceptions are not used in a program, you can use the compiler option features=no%except to suppress generation of code that supports exception handling. The use of the option results in slightly smaller code size and faster code execution. However, when files compiled with exceptions disabled are linked to files using exceptions, some local objects in the files compiled with exceptions disabled are not destroyed when exceptions occur. By default, the compiler generates code to support exception handling. Unless the time and space overhead is significant, leaving exceptions enabled is usually better.


Note -  The C++ standard library, the dynamic_cast operator, and the default operator new require exceptions, so you should not turn off exceptions if you use any of these facilities.