标准库标头 <assert.h>

来自cppreference.com
< c‎ | header


This header is part of the error handling library.

若用户指定的条件非true,则异常终止程序。可以在发行版本禁用。
(宏函数) [编辑]

[编辑] 概要

#if __STDC_VERSION__ >= 202311L
#   define __STDC_VERSION_ASSERT_H__ 202311L
#   ifdef NDEBUG
#       define assert(...) ((void)0)
#   else
#       define assert(...) /* 由实现定义 */
#   endif
#else
#   ifdef NDEBUG
#       define assert(condition) ((void)0)
#   else
#       define assert(condition) /* 由实现定义 */
#   endif
#endif