Assertions <cassert>
Assertions
are Boolean expressions that are expected to be true at a given point in the code. The assert macro of <cassert> is defined similar to this:
#ifdef NDEBUG
#define assert(_)
#else
#define assert(CONDITION) if (!CONDITION) { print_msg(...); std::abort(); }
#endif
If an assertion fails, a
diagnostic message is written to the standard error output, and std::abort() is called, which terminates the application without performing any cleanup. While debugging an application, certain IDEs give you ...