JavaScript is required to for searching.
跳过导航链接
退出打印视图
Oracle Solaris Studio 12.3:C 用户指南     Oracle Solaris Studio 12.3 Information Library (简体中文)
search filter icon
search icon

文档信息

前言

1.  C 编译器介绍

2.  特定于 C 编译器实现的信息

3.  并行化 C 代码

4.  lint 源代码检验器

5.  基于类型的别名分析

6.  转换为 ISO C

7.  转换应用程序以适用于 64 位环境

8.  cscope:交互检查 C 程序

A.  按功能分组的编译器选项

B.  C 编译器选项参考

C.  实现定义的 ISO/IEC C99 行为

D.  C99 的功能

E.  实现定义的 ISO/IEC C90 行为

E.1 与 ISO 标准比较的实现

E.1.1 转换 (G.3.1)

E.1.1.1 (5.1.1.3) Identification of diagnostics(识别诊断):

E.1.2 环境 (G.3.2)

E.1.2.1 (5.1.2.2.1) Semantics of arguments to main(main 的参数的语义):

E.1.2.2 (5.1.2.3) What constitutes an interactive device(交互式设备的要素):

E.1.3 标识符 (G.3.3)

E.1.3.1 (6.1.2) The number of significant initial characters (beyond 31) in an identifier without external linkage(不带外部链接的标识符中的有效初始字符(第 31 个字符之后)的数目):

(6.1.2) The number of significant initial characters (beyond 6) in an identifier with external linkage(带外部链接的标识符中的有效初始字符(第 6 个字符之后)的数目):

E.1.4 字符 (G.3.4)

E.1.4.1 (5.2.1) The members of the source and execution character sets, except as explicitly specified in the Standard(除非标准中明确指定,否则为源代码字符集和执行字符集的成员):

E.1.4.2 (5.2.1.2) The shift states used for the encoding of multibyte characters(用于多字节字符编码的移位状态):

E.1.4.3 (5.2.4.2.1) The number of bits in a character in the execution character set(执行字符集中字符的位数):

E.1.4.4 (6.1.3.4) The mapping of members of the source character set (in character and string literals) to members of the execution character set(源代码字符集成员(用字符和文本字符串表示)至执行字符集成员的映射):

E.1.4.5 (6.1.3.4) The value of an integer character constant that contains a character or escape sequence not represented in the basic execution character set or the extended character set for a wide character constant(包含一个字符的整型字符常量的值或不以基本执行字符集或宽字符常量的扩展字符集表示的换码序列的值):

E.1.4.6 (3.1.3.4) The value of an integer character constant that contains more than one character or a wide character constant that contains more than one multibyte character(包含多个字符的整型字符常量的值或包含多个多字节字符的宽字节常量的值):

E.1.4.7 (6.1.3.4) The current locale used to convert multibyte characters into corresponding wide characters (codes) for a wide character constant(用于针对宽字符常量将多字节字符转换为相应宽字符的当前语言环境):

E.1.4.8 (6.2.1.1) Whether a plain char has the same range of values as signed char or unsigned char(无格式 char 的值范围是与 signed char 相同还是与 unsigned char 相同):

E.1.5 整数 (G.3.5)

E.1.5.1 (6.1.2.5) The representations and sets of values of the various types of integers(各种类型的整数的表示和值集):

E.1.5.2 (6.2.1.2) The result of converting an integer to a shorter signed integer, or the result of converting an unsigned integer to a signed integer of equal length, if the value cannot be represented(值无法表示的情况下,整数转换为较短的带符号整型数的结果,或者无符号整型数转换为同等长度的带符号整型数的结果):

E.1.5.3 (6.3) The results of bitwise operations on signed integers(带符号整型数的按位操作的结果):

E.1.5.4 (6.3.5) The sign of the remainder on integer division(整数除法的余数的符号):

E.1.5.5 (6.3.7) The result of a right shift of a negative-valued signed integral type(负值带符号整型的右移的结果):

E.1.6 浮点 (G.3.6)

E.1.6.1 (6.1.2.5) The representations and sets of values of the various types of floating-point numbers(各种类型的浮点数的表示形式和值集):

E.1.6.2 (6.2.1.3) The direction of truncation when an integral number is converted to a floating-point number that cannot exactly represent the original value(当整数转换为不能精确地表示原始值的浮点数时截断的方向):

E.1.6.3 (6.2.1.4) The direction of truncation or rounding when a floating point number is converted to a narrower floating-point number(当浮点数转换为较窄的浮点数时截断或舍入的方向):

E.1.7 数组和指针 (G.3.7)

E.1.7.1 (6.3.3.4,7.1.1)The type of integer required to hold the maximum size of an array; that is, the type of the sizeof operator, size_t(存放数组的最大大小所需的整型;即 sizeof 运算符的类型 size_t):

E.1.7.2 (6.3.4) The result of casting a pointer to an integer, or vice versa(将指针强制转换为整数的结果,或将整数强制转换为指针的结果):

E.1.7.3 (6.3.6、7.1.1)The type of integer required to hold the difference between two pointers to members of the same array, ptrdiff_t(存放指向同一数组中成员的两个指针之差所需的整型 ptrdiff_t):

E.1.8 寄存器 (G.3.8)

E.1.8.1 (6.5.1) The extent to which objects can actually be placed in registers by use of the register storage-class specifier(可通过使用 register 存储类说明符实际放入寄存器中的对象的范围):

E.1.9 结构、联合、枚举和位字段 (G.3.9)

E.1.9.1 (6.3.2.3) A member of a union object is accessed using a member of a different type(使用不同类型的成员访问的联合对象的成员):

E.1.9.2 (6.5.2.1) The padding and alignment of members of structures(结构成员的填充和对齐)。

E.1.9.3 (6.5.2.1) Whether a plain int bit-field is treated as a signed int bit-field or as an unsigned int bit-field(无格式 int 位字段是视为 signed int 位字段还是视为 unsigned int 位字段处理):

E.1.9.4 (6.5.2.1) The order of allocation of bit-fields within an int(在 int 中位字段的分配顺序):

E.1.9.5 (6.5.2.1) Whether a bit-field can straddle a storageunit boundary(位字段是否可以跨存储单元边界):

E.1.9.6 (6.5.2.2) The integer type chosen to represent the values of an enumeration type(选择用来表示枚举类型的值的整型):

E.1.10 限定符 (G.3.10)

E.1.10.1 (6.5.5.3) What constitutes an access to an object that has volatile-qualified type(什么构成对为 volatile 限定类型的对象的访问):

E.1.11 声明符 (G.3.11)

E.1.11.1 (6.5.4) The maximum number of declarators that may modify an arithmetic, structure, or union type(可修改算术、结构或联合类型的声明数最大值):

E.1.12 语句 (G.3.12)

E.1.12.1 (6.6.4.2) The maximum number of case values in a switch statement(一个 switch 语句中 case 值的最大数目):

E.1.13 预处理指令 (G.3.13)

E.1.13.1 (6.8.1) Whether the value of a singlecharacter character constant in a constant expression that controls conditional inclusion matches the value of the same character constant in the execution character set(控制条件包含的常量表达式中字符常量的值是否与执行字符集内的相同字符常量的值匹配):

E.1.13.2 (6.8.1) Whether such a character constant may have a negative value(这样的字符常量是否可以具有负值):

E.1.13.3 (6.8.2) The method for locating includable source files(定位可包含的源文件的方法):

E.1.13.4 (6.8.2) The support of quoted names for includable source files(对可包含的源文件的带引号名称的支持):

E.1.13.5 (6.8.2) The mapping of source file character sequences(源文件字符序列的映射):

E.1.13.6 (6.8.6) The behavior on each recognized #pragma directive(每个识别的 #pragma 指令的行为):

E.1.13.7 (6.8.8) The definitions for __DATE__ and __TIME__ when, respectively, the date and time of translation are not available(转换的日期和时间分别不可用时 __DATE__ 和 __TIME__ 的定义):

E.1.14 库函数 (G.3.14)

E.1.14.1 (7.1.6) The null pointer constant to which the macro NULL expands(宏 NULL 扩展为的空指针常量):

E.1.14.2 (7.2) The diagnostic printed by and the termination behavior of the assert function(assert 函数输出的诊断及该函数的终止行为):

E.1.14.3 (7.3.1) The sets of characters tested for by the isalnum, isalpha, iscntrl, islower, isprint, and isupper functions(isalnum、isalpha、iscntrl、islower、isprint 和 supper 函数测试的字符集):

E.1.14.4 (7.5.1) The values returned by the mathematics functions on domain errors(发生域错误时数学函数返回的值):

E.1.14.5 (7.5.1) Whether the mathematics functions set the integer expression errno to the value of the macro ERANGE on underflow range errors(在出现下溢范围错误时,数学函数是否将整数表达式 errno 设置为宏 ERANGE 的值):

E.1.14.6 (7.5.6.4) Whether a domain error occurs or zero is returned when the fmod function has a second argument of zero(fmod 函数的第二个参数为零时,发生域错误还是返回零):

E.1.14.7 (7.7.1.1) The set of signals for the signal function(用于 signal 函数的信号集):

E.1.14.8 (7.7.1.1) The default handling and the handling at program startup for each signal recognized by the signal function(针对信号函数识别的每个 signal 的缺省处理和程序启动时的处理):

E.1.14.9 (7.7.1.1) If the equivalent of signal(sig, SIG_DFL); is not executed prior to the call of a signal handler, the blocking of the signal that is performed(如果在调用信号处理程序之前未执行 signal(sig, SIG_DFL) 的等效函数,则阻塞执行的信号):

E.1.14.10 (7.7.1.1) Whether the default handling is reset if the SIGILL signal is received by a handler specified to the signal function(为信号函数指定的处理程序接收到 SIGILL 信号时,是否重置缺省处理):

E.1.14.11 (7.9.2) Whether the last line of a text stream requires a terminating new-line character(文本流的最后一行是否需要终止换行符):

E.1.14.12 (7.9.2) Whether space characters that are written out to a text stream immediately before a new-line character appear when read in(写出到换行符紧前面的文本流中的空格字符在读入时是否出现):

E.1.14.13 (7.9.2) The number of null characters that may be appended to data written to a binary stream(可附加至写入二进制流的数据的空字符数):

E.1.14.14 (7.9.3) Whether the file position indicator of an append mode stream is initially positioned at the beginning or end of the file(附加模式流的文件位置指示器最初位于文件开头还是结尾):

E.1.14.15 (7.9.3) Whether a write on a text stream causes the associated file to be truncated beyond that point(文本流中的写是否导致联合文件在该点之后被截断):

E.1.14.16 (7.9.3) The characteristics of file buffering(文件缓冲的特性):

E.1.14.17 (7.9.3) Whether a zero-length file actually exists(零长度文件是否实际存在):

E.1.14.18 (7.9.3) The rules for composing valid file names(书写有效文件名的规则):

E.1.14.19 (7.9.3) Whether the same file can be open multiple times(同一文件是否可以多次打开):

E.1.14.20 (7.9.4.1) The effect of the remove function on an open file(remove 函数对打开的文件的影响):

E.1.14.21 (7.9.4.2) The effect if a file with the new name exists prior to a call to the rename function(在调用 rename 函数之前已存在具有新名称的文件时的影响):

E.1.14.22 (7.9.6.1) The output for conversion in the fprintf function(fprintf 函数中 %p 转换的输出):

E.1.14.23 (7.9.6.2) The input for conversion in the function(fscanf 函数中 %p 转换的输入):

E.1.14.24 (7.9.6.2) The interpretation of a- character that is neither the first nor the last character in the scan list for %[ conversion in the fscanf function(对既不是 fscanf 函数中 %[ 转换的扫描列表中的第一个字符也不是最后一个字符的 - 字符的解释):

E.1.15 语言环境特定的行为 (G.4)

E.1.15.1 (7.12.1) The local time zone and Daylight Savings Time(本地时区和夏令时):

E.1.15.2 (7.12.2.1) The era for the clock function(clock 函数的年代)

E.1.15.3 (5.2.1) The content of the execution character set, in addition to the required members(执行字符集的内容,以及必需的成员):

E.1.15.4 (5.2.2) The direction of printing(输出方向):

E.1.15.5 (7.1.1) The decimal-point character(小数点字符):

E.1.15.6 (7.3) The implementation-defined aspects of character testing and case mapping functions(字符测试和条件映射函数的实现定义方面):

E.1.15.7 (7.11.4.4) The collation sequence of the execution character set(执行字符集的整理序列):

E.1.15.8 (7.12.3.5) The formats for time and date(时间和日期的格式):

F.  ISO C 数据表示法

G.  性能调节

H.  Oracle Solaris Studio C:K&R C 与 ISO C 之间的差异

索引

E.1 与 ISO 标准比较的实现

E.1.1 转换 (G.3.1)

圆括号中的编号与 ISO/IEC 9899:1990 标准中的节编号对应。

E.1.1.1 (5.1.1.3) Identification of diagnostics(识别诊断):

错误消息具有以下格式:

filename, line line number: message

警告消息具有以下格式:

filename, line line number: warning message

其中:

E.1.2 环境 (G.3.2)

E.1.2.1 (5.1.2.2.1) Semantics of arguments to main(main 的参数的语义):

int main (int argc, char *argv[])
{
....
}

argc 是调用程序时所用的命令行参数的数量。在任何 shell 扩展之后,argc 总是至少等于 1,即程序名称。

argv 是指向命令行参数的指针数组。

E.1.2.2 (5.1.2.3) What constitutes an interactive device(交互式设备的要素):

交互式设备是系统库调用 isatty() 返回非零值的设备。

E.1.3 标识符 (G.3.3)

E.1.3.1 (6.1.2) The number of significant initial characters (beyond 31) in an identifier without external linkage(不带外部链接的标识符中的有效初始字符(第 31 个字符之后)的数目):

前 1,023 个字符是有效字符。标识符区分大小写。

(6.1.2) The number of significant initial characters (beyond 6) in an identifier with external linkage(带外部链接的标识符中的有效初始字符(第 6 个字符之后)的数目):

前 1,023 个字符是有效字符。标识符区分大小写。

E.1.4 字符 (G.3.4)

E.1.4.1 (5.2.1) The members of the source and execution character sets, except as explicitly specified in the Standard(除非标准中明确指定,否则为源代码字符集和执行字符集的成员):

这两个字符集都与 ASCII 字符集相同,并有特定于语言环境的扩展。

E.1.4.2 (5.2.1.2) The shift states used for the encoding of multibyte characters(用于多字节字符编码的移位状态):

无移位状态。

E.1.4.3 (5.2.4.2.1) The number of bits in a character in the execution character set(执行字符集中字符的位数):

对于 ASCII 部分,一个字符中有 8 位;对于特定于语言环境的扩展部分,一个字符中的位数是 8 的倍数,具体取决于语言环境。

E.1.4.4 (6.1.3.4) The mapping of members of the source character set (in character and string literals) to members of the execution character set(源代码字符集成员(用字符和文本字符串表示)至执行字符集成员的映射):

源代码字符与执行字符之间映射相同。

E.1.4.5 (6.1.3.4) The value of an integer character constant that contains a character or escape sequence not represented in the basic execution character set or the extended character set for a wide character constant(包含一个字符的整型字符常量的值或不以基本执行字符集或宽字符常量的扩展字符集表示的换码序列的值):

它是最右边字符的数值。例如,'\q' 等于 'q'。如果这样的换码序列出现,则会发出警告。

E.1.4.6 (3.1.3.4) The value of an integer character constant that contains more than one character or a wide character constant that contains more than one multibyte character(包含多个字符的整型字符常量的值或包含多个多字节字符的宽字节常量的值):

一个多字符常量,它不是具有从每个字符的数值派生的值的转义序列。

E.1.4.7 (6.1.3.4) The current locale used to convert multibyte characters into corresponding wide characters (codes) for a wide character constant(用于针对宽字符常量将多字节字符转换为相应宽字符的当前语言环境):

LC_ALLLC_CTYPELANG 环境变量指定的有效语言环境。

E.1.4.8 (6.2.1.1) Whether a plain char has the same range of values as signed char or unsigned char(无格式 char 的值范围是与 signed char 相同还是与 unsigned char 相同):

A char 被视为 signed char

E.1.5 整数 (G.3.5)

E.1.5.1 (6.1.2.5) The representations and sets of values of the various types of integers(各种类型的整数的表示和值集):

表 E-1 整数的表示和值集

整数
最小值
最大值
char
8
-128
127
signed char
8
-128
127
unsigned char
8
0
255
short
16
-32768
32767
signed short
16
-32768
32767
unsigned short
16
0
65535
int
32
-2147483648
2147483647
signed int
32
-2147483648
2147483647
unsigned int
32
0
4294967295
long -m32
32
-2147483648
2147483647
long -m64
64
-9223372036854775808
9223372036854775807
signed long -m32
32
-2147483648
2147483647
signed long -m64
64
-9223372036854775808
9223372036854775807
unsigned long -m32
32
0
4294967295
unsigned long -m64
64
0
18446744073709551615
long long
64
-9223372036854775808
9223372036854775807
signed long long1
64
-9223372036854775808
9223372036854775807
unsigned long long1
64
0
18446744073709551615

1-Xc 模式下无效

E.1.5.2 (6.2.1.2) The result of converting an integer to a shorter signed integer, or the result of converting an unsigned integer to a signed integer of equal length, if the value cannot be represented(值无法表示的情况下,整数转换为较短的带符号整型数的结果,或者无符号整型数转换为同等长度的带符号整型数的结果):

整数转换为较短的 signed 整数时,低阶位从较长的整数复制到较短的 signed 整数中。结果可能为负数。

无符号整数转换为同等长度的 signed 整数时,低阶位从 unsigned 整数复制到 signed 整数。结果可能为负数。

E.1.5.3 (6.3) The results of bitwise operations on signed integers(带符号整型数的按位操作的结果):

signed 类型应用按位操作的结果是操作数的按位操作,包括 sign 位。因此,当且仅当两个操作数中每个对应的位均已置位时,结果中的每个位才置位。

E.1.5.4 (6.3.5) The sign of the remainder on integer division(整数除法的余数的符号):

结果的符号与被除数相同,因此,-23/4 的余数是 -3。

E.1.5.5 (6.3.7) The result of a right shift of a negative-valued signed integral type(负值带符号整型的右移的结果):

右移的结果为 signed 右移。

E.1.6 浮点 (G.3.6)

E.1.6.1 (6.1.2.5) The representations and sets of values of the various types of floating-point numbers(各种类型的浮点数的表示形式和值集):

表 E-2 float

float
32
最小值
1.17549435E-38
最大值
3.40282347E+38
Epsilon
1.19209290E-07

表 E-3 double

double
64
最小值
2.2250738585072014E-308
最大值
1.7976931348623157E+308
Epsilon
2.2204460492503131E-16

表 E-4 long double

long double
128 (SPARC)

80 (x86)

最小值
3.362103143112093506262677817321752603E-4932 (SPARC)

3.3621031431120935062627E-4932 (x86)

最大值
1.189731495357231765085759326628007016E+4932 (SPARC)

1.1897314953572317650213E4932 (x86)

Epsilon
1.925929944387235853055977942584927319E-34 (SPARC)

1.0842021724855044340075E-19 (x86)

E.1.6.2 (6.2.1.3) The direction of truncation when an integral number is converted to a floating-point number that cannot exactly represent the original value(当整数转换为不能精确地表示原始值的浮点数时截断的方向):

数舍入为可以表示的最近的值。

E.1.6.3 (6.2.1.4) The direction of truncation or rounding when a floating point number is converted to a narrower floating-point number(当浮点数转换为较窄的浮点数时截断或舍入的方向):

数舍入为可以表示的最近的值。

E.1.7 数组和指针 (G.3.7)

E.1.7.1 (6.3.3.4,7.1.1)The type of integer required to hold the maximum size of an array; that is, the type of the sizeof operator, size_t(存放数组的最大大小所需的整型;即 sizeof 运算符的类型 size_t):

stddef.h 中定义的 unsigned int(对于 —m32)。

unsigned long(对于 -m64

E.1.7.2 (6.3.4) The result of casting a pointer to an integer, or vice versa(将指针强制转换为整数的结果,或将整数强制转换为指针的结果):

对于指针以及类型为 intlongunsigned intunsigned long 的值,位模式不变。

E.1.7.3 (6.3.6、7.1.1)The type of integer required to hold the difference between two pointers to members of the same array, ptrdiff_t(存放指向同一数组中成员的两个指针之差所需的整型 ptrdiff_t):

stddef.h 中定义的 int(对于 -m32)。

long(对于 -m64

E.1.8 寄存器 (G.3.8)

E.1.8.1 (6.5.1) The extent to which objects can actually be placed in registers by use of the register storage-class specifier(可通过使用 register 存储类说明符实际放入寄存器中的对象的范围):

有效寄存器声明数取决于每个函数内使用和定义的模式,并受可供分配的寄存器数的限制。不要求编译器和优化器接受寄存器声明。

E.1.9 结构、联合、枚举和位字段 (G.3.9)

E.1.9.1 (6.3.2.3) A member of a union object is accessed using a member of a different type(使用不同类型的成员访问的联合对象的成员):

访问存储在联合成员中的位模式,并根据访问成员时所用的成员类型解释值。

E.1.9.2 (6.5.2.1) The padding and alignment of members of structures(结构成员的填充和对齐)。

表 E-5 结构成员的填充和对齐

类型
对齐边界
字节对齐
char_Bool
字节
1
short
半字
2
int
4
long -m32
4
long -m64
双字
8
long long -m32
双字 (SPARC)

字 (x86)

8 (SPARC)

4 (x86)

long long -m64
双字
8
float
4
double -m32
双字 (SPARC)

字 (x86)

8 (SPARC)

4 (x86)

double -m64
双字
8
long double -m32
双字 (SPARC)

字 (x86)

8 (SPARC)

4 (x86)

long double -m64
四倍长字
16
pointer -m32
4
pointer -m64
四倍长字
8
float _Complex
4
double _Complex -m32
双字 (SPARC)

字 (x86)

8 (SPARC)

4 (x86)

double _Complex -m64
双字
8
long double _Complex -m32
双字 (SPARC)

字 (x86)

8 (SPARC)

4 (x86)

long double _Complex -m64
四倍长字
16
float _Imaginary
4
double _Imaginary -m32
双字 (SPARC)

字 (x86)

8 (SPARC)

4 (x86)

double _Imaginary -m64
双字
8
long double _Imaginary -m32
双字 (SPARC)

字 (x86)

8 (SPARC)

4 (x86)

long double _Imaginary -m64
双字
16

内部填充结构成员,以便各个元素在适当的边界上对齐。

结构的对齐与其更严格对齐的成员相同。例如,只包含 char 数据的 struct 无对齐限制,而包含用 -m64 编译的 double 数据的 struct 将按 8 字节边界对齐。

E.1.9.3 (6.5.2.1) Whether a plain int bit-field is treated as a signed int bit-field or as an unsigned int bit-field(无格式 int 位字段是视为 signed int 位字段还是视为 unsigned int 位字段处理):

视为 unsigned int

E.1.9.4 (6.5.2.1) The order of allocation of bit-fields within an int(在 int 中位字段的分配顺序):

在存储单元中从高阶到低阶分配位字段。

E.1.9.5 (6.5.2.1) Whether a bit-field can straddle a storageunit boundary(位字段是否可以跨存储单元边界):

位字段不可以跨存储单元边界。

E.1.9.6 (6.5.2.2) The integer type chosen to represent the values of an enumeration type(选择用来表示枚举类型的值的整型):

这是 int

E.1.10 限定符 (G.3.10)

E.1.10.1 (6.5.5.3) What constitutes an access to an object that has volatile-qualified type(什么构成对为 volatile 限定类型的对象的访问):

对象名称的每个引用构成对该对象的访问。

E.1.11 声明符 (G.3.11)

E.1.11.1 (6.5.4) The maximum number of declarators that may modify an arithmetic, structure, or union type(可修改算术、结构或联合类型的声明数最大值):

编译器不施加任何限制。

E.1.12 语句 (G.3.12)

E.1.12.1 (6.6.4.2) The maximum number of case values in a switch statement(一个 switch 语句中 case 值的最大数目):

编译器不施加任何限制。

E.1.13 预处理指令 (G.3.13)

E.1.13.1 (6.8.1) Whether the value of a singlecharacter character constant in a constant expression that controls conditional inclusion matches the value of the same character constant in the execution character set(控制条件包含的常量表达式中字符常量的值是否与执行字符集内的相同字符常量的值匹配):

预处理指令中的字符常量与其在任何其他表达式中的数值相同。

E.1.13.2 (6.8.1) Whether such a character constant may have a negative value(这样的字符常量是否可以具有负值):

此上下文中的字符常量可以有负值。

E.1.13.3 (6.8.2) The method for locating includable source files(定位可包含的源文件的方法):

对于由 < > 限定其名称的文件,先在 -I 选项指定的目录中查找,然后在标准目录中查找。标准目录为 /usr/include,除非使用 -YI 选项指定另一个缺省位置。

对于由引号限定其名称的文件,先在包含 #include 的源文件的目录中查找,然后在 -I 选项指定的目录中查找,最后在标准目录中查找。

如果 < > 或双引号中的文件名以 / 字符开头,则文件名解释为根目录开头的路径名。查找该文件时只能在根目录中。

E.1.13.4 (6.8.2) The support of quoted names for includable source files(对可包含的源文件的带引号名称的支持):

支持 include 指令中的带引号文件名。

E.1.13.5 (6.8.2) The mapping of source file character sequences(源文件字符序列的映射):

源文件字符映射至其相应的 ASCII 值。

E.1.13.6 (6.8.6) The behavior on each recognized #pragma directive(每个识别的 #pragma 指令的行为):

支持以下 pragma。有关更多信息,请参见2.11 Pragma

E.1.13.7 (6.8.8) The definitions for __DATE__ and __TIME__ when, respectively, the date and time of translation are not available(转换的日期和时间分别不可用时 __DATE__ 和 __TIME__ 的定义):

环境中总是提供这些宏。

E.1.14 库函数 (G.3.14)

E.1.14.1 (7.1.6) The null pointer constant to which the macro NULL expands(宏 NULL 扩展为的空指针常量):

NULL 等于 0。

E.1.14.2 (7.2) The diagnostic printed by and the termination behavior of the assert function(assert 函数输出的诊断及该函数的终止行为):

诊断为:

Assertion failed: statement . file filename, line number

其中:

E.1.14.3 (7.3.1) The sets of characters tested for by the isalnum, isalpha, iscntrl, islower, isprint, and isupper functions(isalnum、isalpha、iscntrl、islower、isprint 和 supper 函数测试的字符集):

表 E-6 isalphaislower 等测试的字符集

isalnum
ASCII 字符 A-Z、a-z 和 0-9
isalpha
ASCII 字符 A-Z 和 a-z,以及特定于语言环境的单字节字母
iscntrl
值为 0-31 和 127 的 ASCII 字符
islower
ASCII 字符 a-z
isprint
特定于语言环境的单字节可输出字符
isupper
ASCII 字符 A-Z

E.1.14.4 (7.5.1) The values returned by the mathematics functions on domain errors(发生域错误时数学函数返回的值):

表 E-7 发生域错误时返回的值

错误
数学函数
编译器模式
-Xs-Xt
-Xa-Xc
DOMAIN
acos(|x|>1)
0.0
0.0
DOMAIN
asin(|x|>1)
0.0
0.0
DOMAIN
atan2(+-0,+-0)
0.0
0.0
DOMAIN
y0(0)
-HUGE
-HUGE_VAL
DOMAIN
y0(x<0)
-HUGE
-HUGE_VAL
DOMAIN
y1(0)
-HUGE
-HUGE_VAL
DOMAIN
y1(x<0)
-HUGE
-HUGE_VAL
DOMAIN
yn(n,0)
-HUGE
-HUGE_VAL
DOMAIN
yn(n,x<0)
-HUGE
-HUGE_VAL
DOMAIN
log(x<0)
-HUGE
-HUGE_VAL
DOMAIN
log10(x<0)
-HUGE
-HUGE_VAL
DOMAIN
pow(0,0)
0.0
1.0
DOMAIN
pow(0,neg)
0.0
-HUGE_VAL
DOMAIN
pow(neg,non-integal)
0.0
NaN
DOMAIN
sqrt(x<0)
0.0
NaN
DOMAIN
fmod(x,0)
x
NaN
DOMAIN
remainder(x,0)
NaN
NaN
DOMAIN
acosh(x<1)
NaN
NaN
DOMAIN
atanh(|x|>1)
NaN
NaN

E.1.14.5 (7.5.1) Whether the mathematics functions set the integer expression errno to the value of the macro ERANGE on underflow range errors(在出现下溢范围错误时,数学函数是否将整数表达式 errno 设置为宏 ERANGE 的值):

检测到下溢时,除 scalbn 之外的数学函数将 errno 设置为 ERANGE

E.1.14.6 (7.5.6.4) Whether a domain error occurs or zero is returned when the fmod function has a second argument of zero(fmod 函数的第二个参数为零时,发生域错误还是返回零):

在此情况下,它返回第一个参数并发生域错误。

E.1.14.7 (7.7.1.1) The set of signals for the signal function(用于 signal 函数的信号集):

下表列出了 signal 函数可识别的每个信号的语义:

表 E-8 signal 信号的语义

信号
不可以。
缺省
事件
SIGHUP
1
退出
挂起
SIGINT
2
退出
interrupt
SIGQUIT
3
信息转储
quit
SIGILL
4
信息转储
非法指令(找到时不重置)
SIGTRAP
5
信息转储
跟踪陷阱(捕获时不重置)
SIGIOT
6
信息转储
IOT 指令
SIGABRT
6
信息转储
由中止使用
SIGEMT
7
信息转储
EMT 指令
SIGFPE
8
信息转储
浮点异常
SIGKILL
9
退出
中止(找不到,也无法忽略)
SIGBUS
10
信息转储
总线错误
SIGSEGV
11
信息转储
段违规
SIGSYS
12
信息转储
系统调用参数错误
SIGPIPE
13
退出
写在管道上,但无读取者
SIGALRM
14
退出
报警时钟
SIGTERM
15
退出
来自中止的软件终止信号
SIGUSR1
16
退出
用户定义的信号 1
SIGUSR2
17
退出
用户定义的信号 2
SIGCLD
18
忽略
子项状态更改
SIGCHLD
18
忽略
子项状态更改别名
SIGPWR
19
忽略
电源故障,重新启动
SIGWINCH
20
忽略
窗口大小更改
SIGURG
21
忽略
紧急套接字条件
SIGPOLL
22
退出
发生了可轮询事件
SIGIO
22
退出
可能有套接字 I/O
SIGSTOP
23
停止
停止(找不到,也无法忽略)
SIGTSTP
24
停止
来自 tty 的用户停止请求
SIGCONT
25
忽略
停止的进程已继续
SIGTTIN
26
停止
已尝试后台 tty 读
SIGTTOU
27
停止
已尝试后台 tty 写
SIGVTALRM
28
退出
虚拟计时器已过期
SIGPROF
29
退出
分析计时器已过期
SIGXCPU
30
信息转储
已超出 cpu 限制
SIGXFSZ
31
信息转储
已超出文件大小限制
SIGWAITINGT
32
忽略
进程的 lwp 受阻

E.1.14.8 (7.7.1.1) The default handling and the handling at program startup for each signal recognized by the signal function(针对信号函数识别的每个 signal 的缺省处理和程序启动时的处理):

参见以上内容。

E.1.14.9 (7.7.1.1) If the equivalent of signal(sig, SIG_DFL); is not executed prior to the call of a signal handler, the blocking of the signal that is performed(如果在调用信号处理程序之前未执行 signal(sig, SIG_DFL) 的等效函数,则阻塞执行的信号):

总是执行 signal(sig,SIG_DFL) 的等效函数。

E.1.14.10 (7.7.1.1) Whether the default handling is reset if the SIGILL signal is received by a handler specified to the signal function(为信号函数指定的处理程序接收到 SIGILL 信号时,是否重置缺省处理):

接收到 SIGILL 时不重置缺省处理。

E.1.14.11 (7.9.2) Whether the last line of a text stream requires a terminating new-line character(文本流的最后一行是否需要终止换行符):

最后一行不需要以换行符结束。

E.1.14.12 (7.9.2) Whether space characters that are written out to a text stream immediately before a new-line character appear when read in(写出到换行符紧前面的文本流中的空格字符在读入时是否出现):

读该流时,所有字符均出现。

E.1.14.13 (7.9.2) The number of null characters that may be appended to data written to a binary stream(可附加至写入二进制流的数据的空字符数):

空字符不附加至二进制流。

E.1.14.14 (7.9.3) Whether the file position indicator of an append mode stream is initially positioned at the beginning or end of the file(附加模式流的文件位置指示器最初位于文件开头还是结尾):

文件位置指示符最初位于文件结尾。

E.1.14.15 (7.9.3) Whether a write on a text stream causes the associated file to be truncated beyond that point(文本流中的写是否导致联合文件在该点之后被截断):

对文本流的写操作不会导致文件在该点之后被截断,除非硬件设备强制这种情况发生。

E.1.14.16 (7.9.3) The characteristics of file buffering(文件缓冲的特性):

除标准错误流 (stderr) 之外,输出流在输出至文件时采用缺省缓冲,在输出至终端时采用行缓冲。标准错误输出流 (stderr) 在缺省情况下不缓冲。

缓冲的输出流保存多个字符,然后将这些字符作为块进行写入。未缓冲的输出流将信息排队,以便立即在目标文件或终端上写入。行缓冲的输出将输出的每行排队,直至行完成(请求换行符)时为止。

E.1.14.17 (7.9.3) Whether a zero-length file actually exists(零长度文件是否实际存在):

由于零长度文件有目录项,因此它确实存在。

E.1.14.18 (7.9.3) The rules for composing valid file names(书写有效文件名的规则):

有效文件名的长度可以为 1 到 1,023 个字符,可以使用除字符 null 和 /(斜杠)之外的所有字符。

E.1.14.19 (7.9.3) Whether the same file can be open multiple times(同一文件是否可以多次打开):

同一文件可以多次打开。

E.1.14.20 (7.9.4.1) The effect of the remove function on an open file(remove 函数对打开的文件的影响):

在执行关闭文件的最后一个调用时删除文件。程序不能打开已删除的文件。

E.1.14.21 (7.9.4.2) The effect if a file with the new name exists prior to a call to the rename function(在调用 rename 函数之前已存在具有新名称的文件时的影响):

如果该文件存在,则将其删除,并且新文件改写先前存在的文件。

E.1.14.22 (7.9.6.1) The output for conversion in the fprintf function(fprintf 函数中 %p 转换的输出):

%p 的输出与 %x 的相同。

E.1.14.23 (7.9.6.2) The input for conversion in the function(fscanf 函数中 %p 转换的输入):

%p 的输入与 %x 的相同。

E.1.14.24 (7.9.6.2) The interpretation of a- character that is neither the first nor the last character in the scan list for %[ conversion in the fscanf function(对既不是 fscanf 函数中 %[ 转换的扫描列表中的第一个字符也不是最后一个字符的 - 字符的解释):

- 字符表示包括边界的范围,因此 [0-9][0123456789] 等效。

E.1.15 语言环境特定的行为 (G.4)

E.1.15.1 (7.12.1) The local time zone and Daylight Savings Time(本地时区和夏令时):

本地时区由环境变量 TZ 设置。

E.1.15.2 (7.12.2.1) The era for the clock function(clock 函数的年代)

时钟的年代以时钟周期(以程序的起始执行时间为起点)表示。

宿主环境的下列特性特定于语言环境:

E.1.15.3 (5.2.1) The content of the execution character set, in addition to the required members(执行字符集的内容,以及必需的成员):

特定于语言环境(C 语言环境中无扩展)。

E.1.15.4 (5.2.2) The direction of printing(输出方向):

输出总是从左到右进行。

E.1.15.5 (7.1.1) The decimal-point character(小数点字符):

特定于语言环境(在 C 语言环境中为 ".")。

E.1.15.6 (7.3) The implementation-defined aspects of character testing and case mapping functions(字符测试和条件映射函数的实现定义方面):

与 4.3.1 相同。

E.1.15.7 (7.11.4.4) The collation sequence of the execution character set(执行字符集的整理序列):

特定于语言环境(C 语言环境中的 ASCII 整理)。

E.1.15.8 (7.12.3.5) The formats for time and date(时间和日期的格式):

特定于语言环境。下面几个表显示 C 语言环境中的格式。月份名称为:

表 E-9 月份名称

1 月
5 月
9 月
2 月
6 月
10 月
3 月
7 月
11 月
4 月
8 月
12 月

周日期的名称为:

表 E-10 周日期及缩写

日期
缩写
星期日
星期四
星期一
星期五
星期二
星期六
星期三

时间的格式为:

%H:%M:%S

日期的格式为:

%m/%d/%y

上午和下午的格式为:AM PM