Rationale for International Standard - Programming Language - C
Total Page:16
File Type:pdf, Size:1020Kb
Rationale for International Standard - Programming Language - C UNIX is a trademark of X/Open Co., Ltd.. DEC and PDP-11 are trademarks of Digital Equipment Corporation. POSIX is a trademark of IEEE. CONTENTS 0. Introduction..........................................................................................................................1 0.1 Organization of the document .........................................................................................5 1. Scope ...................................................................................................................................6 2. Normative References...........................................................................................................6 3. Terms and definitions............................................................................................................6 4. Conformance........................................................................................................................7 5. Environment.........................................................................................................................8 5.1 Conceptual models..........................................................................................................8 5.1.1 Translation environment...........................................................................................9 5.1.2 Execution environments .........................................................................................10 5.2 Environmental considerations........................................................................................12 5.2.1 Character sets ........................................................................................................12 5.2.2 Character display semantics....................................................................................16 5.2.3 Signals and interrupts.............................................................................................17 5.2.4 Environmental limits...............................................................................................17 6. Language............................................................................................................................21 6.2 Concepts ......................................................................................................................21 6.2.1 Scopes of identifiers...............................................................................................21 6.2.2 Linkages of identifiers ............................................................................................22 6.2.3 Name spaces of identifiers......................................................................................25 6.2.4 Storage durations of objects...................................................................................25 6.2.5 Types.....................................................................................................................27 6.2.7 Compatible type and composite type ......................................................................30 6.3 Conversions..................................................................................................................30 6.3.1 Arithmetic operands...............................................................................................30 6.3.2 Other operands.......................................................................................................33 6.4 Lexical Elements...........................................................................................................35 6.4.1 Keywords...............................................................................................................35 6.4.2 Identifiers...............................................................................................................35 6.4.3 Universal character names......................................................................................36 6.4.4 Constants...............................................................................................................36 6.4.5 String literals..........................................................................................................39 6.4.6 Punctuators............................................................................................................41 6.4.7 Header names.........................................................................................................41 6.4.8 Preprocessing numbers...........................................................................................41 6.4.9 Comments..............................................................................................................42 6.5 Expressions ..................................................................................................................43 6.5.1 Primary expressions................................................................................................46 6.5.2 Postfix operators....................................................................................................46 6.5.3 Unary operators .....................................................................................................49 6.5.4 Cast operators........................................................................................................50 6.5.5 Multiplicative operators..........................................................................................51 i CONTENTS 6.5.6 Additive operators..................................................................................................51 6.5.7 Bitwise shift operators............................................................................................52 6.5.8 Relational operators ...............................................................................................52 6.5.9 Equality operators..................................................................................................53 6.5.15 Conditional operator ............................................................................................53 6.5.16 Assignment operators...........................................................................................53 6.5.17 Comma operator ..................................................................................................55 6.6 Constant expressions ....................................................................................................55 6.7 Declarations..................................................................................................................56 6.7.1 Storage-class specifiers ..........................................................................................56 6.7.2 Type specifiers .......................................................................................................56 6.7.3 Type qualifiers .......................................................................................................61 6.7.4 Function specifiers (inline)......................................................................................66 6.7.5 Declarators ............................................................................................................67 6.7.6 Type names............................................................................................................72 6.7.7 Type definitions......................................................................................................72 6.7.8 Initialization ...........................................................................................................72 6.8 Statements....................................................................................................................74 6.8.1 Labeled statements.................................................................................................74 6.8.2 Compound statement, or block...............................................................................74 6.8.3 Expression and null statements...............................................................................74 6.8.4 Selection statements...............................................................................................74 6.8.5 Iteration statements................................................................................................75 6.8.6. Jump statements....................................................................................................76 6.9 External definitions.......................................................................................................77 6.9.1 Function definitions................................................................................................77 6.10 Preprocessing directives..............................................................................................78 6.10.1 Conditional inclusion............................................................................................78 6.10.2 Source file inclusion .............................................................................................79 6.10.3 Macro replacement...............................................................................................80 6.10.4 Line control..........................................................................................................86 6.10.5 Error directive......................................................................................................86 6.10.6 Pragma