Boost C++ Libraries 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_CONTRACT_ON_MISSING_CHECK_DECL — Code block to execute if contracts are not assigned to a boost::contract::check variable (undefined and executes BOOST_ASSERT(false) by default).


// In header: <boost/contract/core/config.hpp>



In general, there is a logic error in the program when contracts are not explicitly assigned to a local variable of type boost::contract::check and without using C++11 auto declarations (because that is a misuse of this library). Therefore, by default (i.e., when this macro is not defined) this library calls BOOST_ASSERT(false) in those cases. If this macro is defined, this library will execute the code expanded by this macro instead of calling BOOST_ASSERT(false) (if programmers prefer to throw an exception, etc.).

This macro can also be defined to be any block of code (and use empty curly brackets {} to generate no error, not recommended), for example (on GCC):

gcc -DBOOST_CONTRACT_ON_MISSING_CHECK_DECL='{ throw std::logic_error("missing contract check declaration"); }' ...

See Also: