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 for the latest Boost documentation.
PrevUpHomeNext

Macro BOOST_CONTRACT_ON_MISSING_CHECK_DECL

BOOST_CONTRACT_ON_MISSING_CHECK_DECL — Code block to execute if contracts are not assigned to a boost::contract::check variable (undefined by default and executes BOOST_ASSERT(false)).

Synopsis

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

BOOST_CONTRACT_ON_MISSING_CHECK_DECL

Description

In general, there is a logic error in the program when contracts are not assigned to a local variable of type boost::contract::check (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 the macro instead of calling BOOST_ASSERT(false) (if programmers prefer to throw an exception, etc.).

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

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

See Also:

Tutorial


PrevUpHomeNext