Advertisement

Diagnostics

  • Peter Van Weert
  • Marc Gregoire
Chapter

Abstract

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

#ifdef NDEBUG
 #define assert(_)
#else
 #define assert(CONDITION) \
   if (!(CONDITION)) { print_msg(__FILE__, __LINE__, ...); std::abort(); }
#endif

Copyright information

© Peter Van Weert and Marc Gregoire 2019

Authors and Affiliations

  • Peter Van Weert
    • 1
  • Marc Gregoire
    • 2
  1. 1.Kessel-LoBelgium
  2. 2.MeldertBelgium

Personalised recommendations