| Home | Libraries | People | FAQ | More

## 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 and executes `BOOST_ASSERT(false)` by default).

## 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 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: Tutorial