C++ [Error Handling] assert

assert

void assert (int expression);
If the argument expression of this macro with functional form compares equal to zero (i.e., the expression is false), a message is written to the standard error device and abort is called, terminating the program execution.

  • this macro is designed to capture programming errors, not user or run-time errors, since it is generally disabled after a program exits its debugging phase.
  • Expression to be evaluated. If this expression evaluates to 0, this causes an assertion failure that terminates the program.

Categories:

Updated: