Logo

Programming-Idioms

History of Idiom 123 > diff from v20 to v21

Edit summary for version 21 by nuraby:
New C++ implementation by user [nuraby]

Version 20

2020-05-03, 21:31:06

Version 21

2020-05-19, 14:39:44

Idiom #123 Assert condition

Verify that predicate isConsistent returns true, otherwise report assertion violation.
Explain if the assertion is executed even in production environment or not.

Idiom #123 Assert condition

Verify that predicate isConsistent returns true, otherwise report assertion violation.
Explain if the assertion is executed even in production environment or not.

Variables
isConsistent
Variables
isConsistent
Imports
#include <cassert>
Code
assert(isConsistent());
Comments bubble
If NDEBUG macro is defined, the assert macro becomes void. Therefore, such expressions must not have side effects.
Doc URL
https://en.cppreference.com/w/cpp/error/assert