Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.

Boost Exception

Configuration Macros

Boost Exception responds to the following configuration macros:

BOOST_NO_RTTI 
BOOST_NO_TYPEID (both defined automatically by boost/config.hpp)

The first macro prevents Boost Exception from using dynamic_cast and dynamic typeid. If the second macro is also defined, Boost Exception does not use static typeid either. There are no observable degrading effects on the library functionality, except for the following:

By default, the get_error_info function template can be called with any exception type. If BOOST_NO_RTTI is defined, get_error_info can be used only with objects of type boost::exception.

Note:

The library needs RTTI functionality. Disabling the language RTTI support enables an internal RTTI system, which may have more or less overhead depending on the platform.

Note that on some non-conformant compilers, for example MSVC 7.0 and older, as well as BCC, BOOST_EXCEPTION_DISABLE is implicitly defined in boost/throw_exception.hpp.

BOOST_NO_EXCEPTIONS (defined automatically by boost/config.hpp)

This macro disables exception handling in Boost, forwarding all exceptions to a user-defined non-template version of boost::throw_exception. However, unless BOOST_EXCEPTION_DISABLE is also defined, users can still examine the exception object for any data added at the point of the throw, or use boost::diagnostic_information (of course under BOOST_NO_EXCEPTIONS, the user-defined boost::throw_exception is not allowed to return to the caller.)

In addition, the following user-defined macros are recognized:

BOOST_EXCEPTION_DISABLE (user-defined)

By default, enable_current_exception and enable_error_info are integrated directly in the throw_exception function. Defining BOOST_EXCEPTION_DISABLE disables this integration.