logo资料库

ISO/IEC 9899:1999 (C99).pdf

第1页 / 共550页
第2页 / 共550页
第3页 / 共550页
第4页 / 共550页
第5页 / 共550页
第6页 / 共550页
第7页 / 共550页
第8页 / 共550页
资料共550页,剩余部分请下载后查看
©ISO/IEC ISO/IEC 9899:1999 (E) 5.2 Environmental considerations . . 6. Language . 6.1 Notation 6.2 Concepts . . . . . . . . . . . . . . . . . . . . . . . . Contents . . Foreword . . Introduction . . 1. Scope . 2. Normative references 3. Terms, definitions, and symbols . 4. Conformance . 5. Environment . 5.1 Conceptual models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.1.1 5.1.2 . . . . . . . . . . . . . . . . . . . . . . . . Signals and interrupts Environmental limits . . . . . . . . . . . . Translation environment Execution environments . . . . . . . . . . . . 5.2.1 Character sets 5.2.2 Character display semantics . 5.2.3 . 5.2.4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.2.1 . . 6.2.2 . 6.2.3 Name spaces of identifiers . 6.2.4 . . 6.2.5 . 6.2.6 Representations of types 6.2.7 Compatible type and composite type . . . . . . . . . . . . . . Storage durations of objects Types 6.3.1 Arithmetic operands 6.3.2 Other operands . . . . . 6.4.1 Keywords . 6.4.2 Identifiers 6.4.3 Universal character names . 6.4.4 Constants . 6.4.5 . 6.4.6 . 6.4.7 Header names 6.4.8 6.4.9 Comments . . . . . Preprocessing numbers . . . String literals Punctuators Scopes of identifiers Linkages of identifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.3 Conversions . 6.4 Lexical elements 6.5 Expressions Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi xiv 1 2 3 7 9 9 9 11 17 17 19 20 20 29 29 29 29 30 31 32 33 37 40 42 42 46 49 50 51 53 54 62 63 64 65 66 67 iii
ISO/IEC 9899:1999 (E) ©ISO/IEC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.6 Constant expressions . 6.7 Declarations Equality operators Primary expressions 6.5.1 . Postfix operators 6.5.2 . 6.5.3 Unary operators . 6.5.4 Cast operators 6.5.5 Multiplicative operators . 6.5.6 Additive operators 6.5.7 Bitwise shift operators 6.5.8 Relational operators 6.5.9 6.5.10 Bitwise AND operator 6.5.11 Bitwise exclusive OR operator 6.5.12 Bitwise inclusive OR operator . 6.5.13 Logical AND operator . 6.5.14 Logical OR operator . 6.5.15 Conditional operator . 6.5.16 Assignment operators . . 6.5.17 Comma operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Expression and null statements . Selection statements . Iteration statements . Jump statements . . . . . . . . . . . . . . Storage-class specifiers . . Type specifiers . . Type qualifiers . Function specifiers . . . . . . . . . . Labeled statements 6.7.1 6.7.2 6.7.3 6.7.4 . 6.7.5 Declarators . Type names 6.7.6 Type definitions 6.7.7 6.7.8 Initialization 6.8 Statements and blocks 6.10 Preprocessing directives 6.9 External definitions . . . . . . . . . . . . . . . . 6.8.1 6.8.2 Compound statement 6.8.3 6.8.4 6.8.5 6.8.6 . . . . . . Function definitions External object definitions . . . . . . . . 6.10.1 Conditional inclusion 6.10.2 Source file inclusion 6.10.3 Macro replacement . 6.10.4 Line control . 6.10.5 Error directive 6.10.6 Pragma directive 6.9.1 6.9.2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 . 69 . 78 . 81 . 82 . 82 . 84 . 85 . 86 . 87 . 88 . 88 . 89 . 89 . 90 . 91 . 94 . 95 . 97 . 98 . 99 . 108 . 112 . 114 . 122 . 123 . 125 . 131 . 131 . 132 . 132 . 133 . 135 . 136 . 140 . 141 . 143 . 145 . 147 . 149 . 151 . 158 . 159 . 159 iv Contents
©ISO/IEC ISO/IEC 9899:1999 (E) 7. Library . . . . . . . . . . . . . . . . . . . . . . . . . . 7.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.2.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Standard headers . . . . . . . . . . . . . . . . . . . . . . . . . . . . Program diagnostics 7.2 Diagnostics . 6.10.7 Null directive 6.10.8 Predefined macro names . 6.10.9 Pragma operator . 6.11 Future language directions . . 6.11.1 Floating types 6.11.2 Linkages of identifiers . 6.11.3 External names 6.11.4 Character escape sequences 6.11.5 Storage-class specifiers 6.11.6 Function declarators . 6.11.7 Function definitions . 6.11.8 Pragma directives 6.11.9 Predefined macro names . . . . . Introduction . 7.1.1 Definitions of terms . 7.1.2 . 7.1.3 Reserved identifiers 7.1.4 Use of library functions . . . . . . . . . . . . . . 7.3 Complex arithmetic . . . . . . . . . . . . . . . . . . . . . . . . . . . . The CX_LIMITED_RANGE pragma . Trigonometric functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.7 Characteristics of floating types 7.8 Format conversion of integer types . Introduction 7.3.1 7.3.2 Conventions 7.3.3 Branch cuts 7.3.4 7.3.5 7.3.6 Hyperbolic functions 7.3.7 7.3.8 7.3.9 Manipulation functions 7.4 Character handling . . Exponential and logarithmic functions Power and absolute-value functions . . . . 7.4.1 Character classification functions 7.4.2 Character case mapping functions . . 7.5 Errors 7.6 Floating-point environment 7.8.1 Macros for format specifiers 7.8.2 . Functions for greatest-width integer types 7.6.1 7.6.2 7.6.3 Rounding 7.6.4 The FENV_ACCESS pragma Floating-point exceptions . . Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160 . 160 . 161 . 163 . 163 . 163 . 163 . 163 . 163 . 163 . 163 . 163 . 163 . 164 . 164 . 164 . 165 . 166 . 166 . 169 . 169 . 170 . 170 . 171 . 171 . 171 . 172 . 174 . 176 . 177 . 178 . 181 . 181 . 184 . 186 . 187 . 189 . 190 . 192 . 194 . 196 . 197 . 197 . 198 v . . . . . Contents
ISO/IEC 9899:1999 (E) ©ISO/IEC . . . . . . . . . . . . . . . . . . . . . . . 7.12 Mathematics 7.9 Alternative spellings . 7.10 Sizes of integer types . 7.11 Localization . . . . . . 7.11.1 Locale control 7.11.2 Numeric formatting convention inquiry . . . 7.12.1 Treatment of error conditions . 7.12.2 The FP_CONTRACT pragma . . 7.12.3 Classification macros . . 7.12.4 Trigonometric functions . . 7.12.5 Hyperbolic functions 7.12.6 Exponential and logarithmic functions 7.12.7 Power and absolute-value functions . 7.12.8 Error and gamma functions . 7.12.9 Nearest integer functions . 7.12.10 Remainder functions . 7.12.11 Manipulation functions 7.12.12 Maximum, minimum, and positive difference functions 7.12.13 Floating multiply-add 7.12.14 Comparison macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.13 Nonlocal jumps . . . . . . . . . 7.15.1 Variable argument list access macros 7.13.1 Save calling environment 7.13.2 Restore calling environment . . . 7.14.1 Specify signal handling . 7.14.2 Send signal . 7.15 Variable arguments 7.14 Signal handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Integer types 7.19 Input/output 7.16 Boolean type and values 7.17 Common definitions . 7.18 Integer types . . . . . . 7.18.1 7.18.2 Limits of specified-width integer types . 7.18.3 Limits of other integer types . 7.18.4 Macros for integer constants . . . . . . . . . . . . . . . . 7.19.1 . 7.19.2 Streams . . 7.19.3 Files 7.19.4 Operations on files 7.19.5 File access functions 7.19.6 Formatted input/output functions 7.19.7 Character input/output functions 7.19.8 Direct input/output functions Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vi Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201 . 202 . 203 . 204 . 205 . 211 . 213 . 214 . 215 . 217 . 220 . 222 . 227 . 229 . 230 . 234 . 235 . 237 . 238 . 239 . 242 . 242 . 243 . 245 . 246 . 247 . 248 . 248 . 252 . 253 . 254 . 254 . 256 . 258 . 259 . 261 . 261 . 263 . 265 . 267 . 269 . 273 . 294 . 299 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
©ISO/IEC ISO/IEC 9899:1999 (E) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Integer arithmetic functions 7.21 String handling 7.20 General utilities 7.19.9 File positioning functions 7.19.10 Error-handling functions . . . . 7.20.1 Numeric conversion functions 7.20.2 Pseudo-random sequence generation functions . . 7.20.3 Memory management functions . 7.20.4 Communication with the environment . . 7.20.5 Searching and sorting utilities . . 7.20.6 7.20.7 Multibyte/wide character conversion functions 7.20.8 Multibyte/wide string conversion functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.24 Extended multibyte and wide character utilities . . . . . . 7.21.1 String function conventions . 7.21.2 Copying functions 7.21.3 Concatenation functions 7.21.4 Comparison functions . . 7.21.5 Search functions 7.21.6 Miscellaneous functions 7.22 Type-generic math . 7.23 Date and time . . . 7.24.1 . 7.24.2 Formatted wide character input/output functions . . 7.24.3 Wide character input/output functions . . . 7.24.4 General wide string utilities . . 7.24.5 Wide character time conversion functions 7.24.6 Extended multibyte/wide character conversion utilities . . 7.23.1 Components of time 7.23.2 Time manipulation functions 7.23.3 Time conversion functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Introduction 7.26 Future library directions 7.25 Wide character classification and mapping utilities . . . . . . . . . 7.25.1 . 7.25.2 Wide character classification utilities . 7.25.3 Wide character case mapping utilities . . . 7.26.1 Complex arithmetic . 7.26.2 Character handling . . 7.26.3 Errors 7.26.4 Format conversion of integer types . . 7.26.5 Localization . . 7.26.6 Signal handling . 7.26.7 Boolean type and values . . 7.26.8 . . 7.26.9 Integer types Input/output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300 . 303 . 305 . 306 . 311 . 312 . 314 . 317 . 319 . 320 . 322 . 324 . 324 . 324 . 326 . 327 . 329 . 332 . 334 . 337 . 337 . 338 . 340 . 347 . 347 . 348 . 366 . 370 . 384 . 385 . 392 . 392 . 393 . 398 . 400 . 400 . 400 . 400 . 400 . 400 . 400 . 400 . 400 . 401 vii
ISO/IEC 9899:1999 (E) ©ISO/IEC . 7.26.10 General utilities . 7.26.11 String handling 7.26.12 Extended multibyte and wide character utilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.26.13 Wide character classification and mapping utilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A.1 Lexical grammar A.2 Phrase structure grammar A.3 Preprocessing directives . Annex A (informative) Language syntax summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Annex B (informative) Library summary . . . . . . B.1 Diagnostics . . . . . . B.2 Complex . . . . . B.3 Character handling . . . . . . B.4 Errors . . . . B.5 Floating-point environment . . . B.6 Characteristics of floating types . . B.7 Format conversion of integer types . B.8 Alternative spellings . . . . . . B.9 Sizes of integer types . . . . B.10 Localization . . . . B.11 Mathematics . . . . B.12 Nonlocal jumps . . B.13 Signal handling . . . . . . B.14 Variable arguments . . . B.15 Boolean type and values . . . B.16 Common definitions . . . . B.17 Integer types . . . . B.18 Input/output . . . B.19 General utilities . . . . B.20 String handling . . . B.21 Type-generic math . . . . B.22 Date and time . B.23 Extended multibyte/wide character utilities B.24 Wide character classification and mapping utilities . . . . . . . Annex C (informative) Sequence points Annex D (normative) Universal character names for identifiers Annex E (informative) Implementation limits Annex F (normative) IEC 60559 floating-point arithmetic Introduction . F.1 F.2 Types F.3 Operators and functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 401 . 401 . 401 . 401 . 402 . 402 . 408 . 415 . 417 . 417 . 417 . 419 . 419 . 419 . 420 . 420 . 421 . 421 . 421 . 421 . 426 . 426 . 426 . 426 . 427 . 427 . 427 . 429 . 431 . 432 . 432 . 433 . 435 . 437 . 438 . 440 . 442 . 442 . 442 . 443 viii Contents
©ISO/IEC ISO/IEC 9899:1999 (E) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Introduction G.1 . . G.2 Types . G.3 Conventions . G.4 Conversions . G.5 Binary operators G.6 Complex arithmetic G.7 Type-generic math . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Floating to integer conversion F.4 F.5 Binary-decimal conversion . F.6 Contracted expressions Floating-point environment F.7 . . F.8 Optimization F.9 Mathematics . . . . . . Annex G (informative) IEC 60559-compatible complex arithmetic . . . . . . . . . . . . . . . . . . . . . . . . . . . Annex H (informative) Language independent arithmetic . . . . . . . . . . . . . . . Annex I (informative) Common warnings Annex J (informative) Portability issues . . J.1 Unspecified behavior J.2 Undefined behavior J.3 J.4 Locale-specific behavior . J.5 Common extensions . . . . . . Implementation-defined behavior . . . . Introduction H.1 . H.2 Types H.3 Notification Bibliography . Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 445 . 445 . 446 . 446 . 449 . 452 . 465 . 465 . 465 . 465 . 466 . 466 . 470 . 478 . 479 . 479 . 479 . 483 . 485 . 487 . 487 . 490 . 503 . 510 . 511 . 514 . 517 Contents ix
ISO/IEC 9899:1999 (E) ©ISO/IEC x Contents
分享到:
收藏