Upload
others
View
11
Download
1
Embed Size (px)
Citation preview
WG14/N1124 Committee Draft — May 6, 2005 ISO/IEC 9899:TC2
ContentsForeword . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiv
1. Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
2. Normative references . . . . . . . . . . . . . . . . . . . . . . . 2
3. Terms, definitions, and symbols . . . . . . . . . . . . . . . . . . . 3
4. Conformance . . . . . . . . . . . . . . . . . . . . . . . . . . 7
5. Environment . . . . . . . . . . . . . . . . . . . . . . . . . . 95.1 Conceptual models . . . . . . . . . . . . . . . . . . . . . 9
5.1.1 Translation environment . . . . . . . . . . . . . . . . 95.1.2 Execution environments . . . . . . . . . . . . . . . . 11
5.2 Environmental considerations . . . . . . . . . . . . . . . . . 175.2.1 Character sets . . . . . . . . . . . . . . . . . . . . 175.2.2 Character display semantics . . . . . . . . . . . . . . 195.2.3 Signals and interrupts . . . . . . . . . . . . . . . . . 205.2.4 Environmental limits . . . . . . . . . . . . . . . . . 20
6. Language . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296.1 Notation . . . . . . . . . . . . . . . . . . . . . . . . . . 296.2 Concepts . . . . . . . . . . . . . . . . . . . . . . . . . 29
6.2.1 Scopes of identifiers . . . . . . . . . . . . . . . . . 296.2.2 Linkages of identifiers . . . . . . . . . . . . . . . . . 306.2.3 Name spaces of identifiers . . . . . . . . . . . . . . . 316.2.4 Storage durations of objects . . . . . . . . . . . . . . 326.2.5 Types . . . . . . . . . . . . . . . . . . . . . . . 336.2.6 Representations of types . . . . . . . . . . . . . . . . 376.2.7 Compatible type and composite type . . . . . . . . . . . 40
6.3 Conversions . . . . . . . . . . . . . . . . . . . . . . . . 426.3.1 Arithmetic operands . . . . . . . . . . . . . . . . . 426.3.2 Other operands . . . . . . . . . . . . . . . . . . . 46
6.4 Lexical elements . . . . . . . . . . . . . . . . . . . . . . 496.4.1 Keywords . . . . . . . . . . . . . . . . . . . . . . 506.4.2 Identifiers . . . . . . . . . . . . . . . . . . . . . . 516.4.3 Universal character names . . . . . . . . . . . . . . . 536.4.4 Constants . . . . . . . . . . . . . . . . . . . . . . 546.4.5 String literals . . . . . . . . . . . . . . . . . . . . 626.4.6 Punctuators . . . . . . . . . . . . . . . . . . . . . 636.4.7 Header names . . . . . . . . . . . . . . . . . . . . 646.4.8 Preprocessing numbers . . . . . . . . . . . . . . . . 656.4.9 Comments . . . . . . . . . . . . . . . . . . . . . 66
6.5 Expressions . . . . . . . . . . . . . . . . . . . . . . . . 67
Contents iii
ISO/IEC 9899:TC2 Committee Draft — May 6, 2005 WG14/N1124
6.5.1 Primary expressions . . . . . . . . . . . . . . . . . 696.5.2 Postfix operators . . . . . . . . . . . . . . . . . . . 696.5.3 Unary operators . . . . . . . . . . . . . . . . . . . 786.5.4 Cast operators . . . . . . . . . . . . . . . . . . . . 816.5.5 Multiplicative operators . . . . . . . . . . . . . . . . 826.5.6 Additive operators . . . . . . . . . . . . . . . . . . 826.5.7 Bitwise shift operators . . . . . . . . . . . . . . . . . 846.5.8 Relational operators . . . . . . . . . . . . . . . . . . 856.5.9 Equality operators . . . . . . . . . . . . . . . . . . 866.5.10 Bitwise AND operator . . . . . . . . . . . . . . . . . 876.5.11 Bitwise exclusive OR operator . . . . . . . . . . . . . 886.5.12 Bitwise inclusive OR operator . . . . . . . . . . . . . . 886.5.13 Logical AND operator . . . . . . . . . . . . . . . . . 896.5.14 Logical OR operator . . . . . . . . . . . . . . . . . 896.5.15 Conditional operator . . . . . . . . . . . . . . . . . 906.5.16 Assignment operators . . . . . . . . . . . . . . . . . 916.5.17 Comma operator . . . . . . . . . . . . . . . . . . . 94
6.6 Constant expressions . . . . . . . . . . . . . . . . . . . . . 956.7 Declarations . . . . . . . . . . . . . . . . . . . . . . . . 97
6.7.1 Storage-class specifiers . . . . . . . . . . . . . . . . 986.7.2 Type specifiers . . . . . . . . . . . . . . . . . . . . 996.7.3 Type qualifiers . . . . . . . . . . . . . . . . . . . . 1086.7.4 Function specifiers . . . . . . . . . . . . . . . . . . 1126.7.5 Declarators . . . . . . . . . . . . . . . . . . . . . 1146.7.6 Type names . . . . . . . . . . . . . . . . . . . . . 1226.7.7 Type definitions . . . . . . . . . . . . . . . . . . . 1236.7.8 Initialization . . . . . . . . . . . . . . . . . . . . 125
6.8 Statements and blocks . . . . . . . . . . . . . . . . . . . . 1316.8.1 Labeled statements . . . . . . . . . . . . . . . . . . 1316.8.2 Compound statement . . . . . . . . . . . . . . . . . 1326.8.3 Expression and null statements . . . . . . . . . . . . . 1326.8.4 Selection statements . . . . . . . . . . . . . . . . . 1336.8.5 Iteration statements . . . . . . . . . . . . . . . . . . 1356.8.6 Jump statements . . . . . . . . . . . . . . . . . . . 136
6.9 External definitions . . . . . . . . . . . . . . . . . . . . . 1406.9.1 Function definitions . . . . . . . . . . . . . . . . . . 1416.9.2 External object definitions . . . . . . . . . . . . . . . 143
6.10 Preprocessing directives . . . . . . . . . . . . . . . . . . . 1456.10.1 Conditional inclusion . . . . . . . . . . . . . . . . . 1476.10.2 Source file inclusion . . . . . . . . . . . . . . . . . 1496.10.3 Macro replacement . . . . . . . . . . . . . . . . . . 1516.10.4 Line control . . . . . . . . . . . . . . . . . . . . . 1586.10.5 Error directive . . . . . . . . . . . . . . . . . . . . 1596.10.6 Pragma directive . . . . . . . . . . . . . . . . . . . 159
iv Contents