The concept of assert assertion

assert is used to test conditional expressions in the DEBUG version of the program.

If the condition is false, output a diagnostic message and terminate the program.

Since assert is a macro, using it too frequently will affect the performance of the program to a certain extent, adding extra overhead. A good programming practice is to disable the assert macro by inserting #define NDEBUG before the #include statement after debugging.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325689957&siteId=291194637