NDEBUG
C 标准库约定的预处理宏,定义后会使 assert 展开为空语句从而在编译期移除断言,是 C/C++ 构建配置中控制断言行为的传统机制
Timeline (last 90 days)
The debug breakpoints provided by <debugging> are not affected by the NDEBUG macro and should be available under all build configurations.
When NDEBUG is defined (usually in Release builds), the assert macro is expanded to a no-op.
When the NDEBUG macro is defined, the standard header <cassert> expands assert(expr) into an empty statement, thereby completely removing the assertion at compile time.
NDEBUG is global and cannot be controlled differentially per function, per module, or per class condition.
All Facts (4)
The debug breakpoints provided by <debugging> are not affected by the NDEBUG macro and should be available under all build configurations.
50%UnverifiedWhen NDEBUG is defined (usually in Release builds), the assert macro is expanded to a no-op.
50%UnverifiedWhen the NDEBUG macro is defined, the standard header <cassert> expands assert(expr) into an empty statement, thereby completely removing the assertion at compile time.
50%UnverifiedNDEBUG is global and cannot be controlled differentially per function, per module, or per class condition.
50%