assert.h

简介: assert.h

简介

C 标准库的 assert.h 头文件提供了一个名为 assert,它可用于验证程序做出的假设,并在假设为假时输出诊断消息。


已定义的宏 assert 指向另一个宏 NDEBUG ,宏 NDEBUG 不是 <assert.h> 的一部分。如果已在引用 <assert.h> 的源文件中定义 NDEBUG 为宏名称,则 assert 宏的定义如下:

#define assert(ignore) ((void)0)


库宏

下面列出了头文件 assert.h 中定义的唯一的函数:

函数 描述
void assert(int expression) 这实际上是一个,不是一个函数,可用于在 C 程序中添加诊断


目录
相关文章
|
1月前
assert()函数用法总结
assert()函数用法总结
|
1月前
|
人工智能
assert()函数(断言函数)
assert()函数(断言函数)
assert()函数(断言函数)
|
2月前
C标准库 - <assert.h>
C标准库 - <assert.h>。
14 1
|
1月前
|
安全 算法 程序员
【C++ 空指针的判断】深入理解 C++11 中的 nullptr 和 nullptr_t
【C++ 空指针的判断】深入理解 C++11 中的 nullptr 和 nullptr_t
48 0
|
5月前
|
编译器 C语言 C++
【C++】nullptr C++中的空指针(C++11)
【C++】nullptr C++中的空指针(C++11)
|
10月前
|
编译器 C++
C++11之空指针-nullptr
C++11之空指针-nullptr
100 0
|
11月前
|
程序员 C语言 C++
C++空指针NULL和nullptr
🐰C++空指针NULL和nullptr 🏡空指针
|
11月前
|
Python
断言(assert)的用法
断言(assert)的用法
Assert断言的使用
Assert断言的使用
157 0