错误处理
< c
错误号
定义于头文件
<errno.h> |
|
展开成 POSIX 兼容的线程局域错误编号变量 (宏变量) |
|
标准 POSIX 兼容的错误条件宏 (宏常量) |
断言
定义于头文件
<assert.h> |
|
若用户指定的条件非true,则异常终止程序。可以在发行版本禁用。 (宏函数) |
|
(C11)
|
若常量表达式为假则发布编译诊断 (关键词宏) |
边界检查标准库提供了一些既存函数的边界检查版本( gets_s 、 fopen_s 、 printf_s 、 strcpy_s 、 wcscpy_s 、 mbstowcs_s 、 qsort_s 、 getenv_s 等)。这些功能是可选的,并且仅若定义 __STDC_LIB_EXT1__ 才可用。下列宏和函数支持此功能。
注意:边界检查函数的实现可用于开源库 Safe C 及 Slibc ,还有 Watcom C 的一部分。亦有可用于 Visual Studio 的边界检查函数的不兼容集合。 |
(C11 起) |
引用
- C11 标准(ISO/IEC 9899:2011):
-
- 7.2 Diagnostics <assert.h> (p: 186-187)
-
- 7.5 Errors <errno.h> (p: 205)
-
- 7.19 Common definitions <stddef.h> (p: 288)
-
- 7.20 Integer types <stdint.h> (p: 289-295)
-
- 7.21 Input/output <stdio.h> (p: 296-339)
-
- 7.22 General utilities <stdlib.h> (p: 340-360)
-
- K.3.1.3 Use of errno (p: 584)
-
- K.3.2/2 errno_t (p: 585)
-
- K.3.3/2 rsize_t (p: 585)
-
- K.3.4/2 RSIZE_MAX (p: 585)
-
- 7.31.3 Errors <errno.h> (p: 455)
-
- 7.31.10 Integer types <stdint.h> (p: 456)
-
- 7.31.11 Input/output <stdio.h> (p: 456)
-
- 7.31.12 General utilities <stdlib.h> (p: 456)
- C99 标准(ISO/IEC 9899:1999):
-
- 7.2 Diagnostics <assert.h> (p: 169)
-
- 7.5 Errors <errno.h> (p: 186)
-
- 7.26.3 Errors <errno.h> (p: 401)
-
- 7.26.8 Integer types <stdint.h> (p: 401)
-
- 7.26.9 Input/output <stdio.h> (p: 402)
-
- 7.26.10 General utilities <stdlib.h> (p: 402)
- C89/C90 标准(ISO/IEC 9899:1990):
-
- 4.2 DIAGNOSTICS <assert.h>
-
- 4.1.3 Errors <errno.h>
-
- 4.13.1 Errors <errno.h>
-
- 4.13.6 Input/output <stdio.h>
-
- 4.13.7 General utilities <stdlib.h>
参阅
(C99)(C99)(C99)
|
定义用于常用数学函数的错误处理机制 (宏常量) |