This should speed up the use of the assert function.
void assert (int expression);
Evaluate a statement If the argument expression of this macro with the functional form is compared to zero (i.e., the expression is false), the message is written to the standard error device and an interrupt is called, terminating the program.
The specificity of the displayed message depends on the particular implementation in the compiler, but it should include: an expression whose statement failed, the name of the source file and the line number in which it occurred. The usual expression format is:
Assertion failed: expression, file name, line number This macro is disabled if a macro named NDEBUG is already defined at the time you turned on assert.h. This allows the encoder to include many assert calls in the source code when debugging the program, and then disable all of them for the production version by simply including a line, for example:
Thus, this macro is designed to capture programming errors, not user errors or launches, as it usually shuts down after the program exits the debug phase. from: C ++ Ref
Alireza soori
source share