Contracts without the macros - September 2, 2017
Pre-release
Pre-release
- Using plain C++ code instead of macros to program contracts.
The removed macros very hard to use because they required programmers to learn a domain-specific embedded language that replaced the usual C++ syntax for declaring functions and classes.
The removed macros also made the code less readable, increased compilation time (because of extensive preprocessor meta-programming), and gave cryptic compiler errors.
However, the removed macros more correctly specified contracts in code declarations instead of definitions, and they completely removed extra code when contracts were disabled (both of those can be done by the current version of this library but at the cost of manually writing some boiler-plate code which was previous automatically handled by the macros instead, see Separate Body Implementation and Disable Contract Compilation). - Simplified the library by removing some extra features that were not directly related to contract programming, specifically:
Removed loop variants (because these are rarely if ever used).
Removed named and deduced parameters (because these can be programmed directly using Boost.Parameter).
Removed concepts (because these can be programmed directly using Boost.ConceptCheck).
Removed emulation of virtual specifiers override, final, and new (because override can be programmed directly using C++11, while final and new are rarely if ever used).
Removed static_assert emulation (because this can be programmed directly using C++11, or using Boost.StaticAssert). - Ensuring that old values and return values are copied only once even when subcontracting is used with multiple inheritance.
- Improved template meta-programming algorithm that searches the inheritance tree for subcontracting when multiple inheritance is used.
- Exception specifications and function-try blocks apply also to exceptions thrown by the contracts, and not just to exceptions thrown by the body.
- Added contracts for exception guarantees (using .except(...), etc.).
- Added predefined assertion levels for "audit" and "axiom".
- Added call_if and condition_if (assertions requirements were supported also by previous revisions of this library but they were handled by internal code generated by the contract macros).