ISO/IEC9899:2011(E) ISO/IEC 2011 - All rights reserved2177.8Format conversion of integertypes<inttypes.h>2177.8.1Macrosforformat specifiers2187.8.2Functions for greatest-width integer types2217.9Alternative spellings<iso646.h>2227.10Sizesof integertypes<limits.h>2237.11 Localization<locale.h>2247.11.1Localecontrol2257.11.2Numeric formatting convention inquiry2317.12 Mathematics<math.h>2337.12.1Treatment oferror conditions2357.12.2TheFP_CONTRACTpragma7.12.3235Classificationmacros2387.12.4Trigonometric functions2407.12.5Hyperbolic functions2427.12.6Exponential and logarithmic functions2477.12.7Power and absolute-value functions2497.12.8Error and gamma functions2517.12.9Nearest integer functions2547.12.10 Remainder functions2557.12.11 Manipulation functions2577.12.12Maximum,minimum,and positivedifference functions2587.12.13 Floating multiply-add2597.12.14 Comparison macros2627.13 Nonlocal jumps<setjmp.h>2627.13.1Save calling environment2637.13.2Restorecalling environment2657.14 Signal handling<signa1.h>2667.14.1Specify signal handling2677.14.2Send signal2687.15 Alignment<stdalign.h>2697.16Variablearguments<stdarg.h>2697.16.1Variable argument list access macros2737.17Atomics<stdatomic.h>7.17.1273Introduction2747.17.2Initialization2757.17.3Order and consistency7.17.4278Fences2797.17.5Lock-freeproperty2807.17.6Atomicintegertypes2827.17.7Operationsonatomictypes2857.17.8Atomicflagtypeandoperations2877.18 Boolean type and values<stdboo1.h>2887.19 Common definitions<stddef.h>2897.20 Integertypes<stdint.h>viContents
ISO/IEC 9899:2011 (E) © ISO/IEC 2011 − All rights reserved 7.8 Format conversion of integer types <inttypes.h> . 217 7.8.1 Macros for format specifiers . 217 7.8.2 Functions for greatest-width integer types . 218 7.9 Alternative spellings <iso646.h> . 221 7.10 Sizes of integer types <limits.h> . 222 7.11 Localization <locale.h> . 223 7.11.1 Locale control . 224 7.11.2 Numeric formatting convention inquiry . 225 7.12 Mathematics <math.h> . 231 7.12.1 Treatment of error conditions . 233 7.12.2 The FP_CONTRACT pragma . 235 7.12.3 Classification macros . 235 7.12.4 Trigonometric functions . 238 7.12.5 Hyperbolic functions . 240 7.12.6 Exponential and logarithmic functions . 242 7.12.7 Power and absolute-value functions . 247 7.12.8 Error and gamma functions . 249 7.12.9 Nearest integer functions . 251 7.12.10 Remainder functions . 254 7.12.11 Manipulation functions . 255 7.12.12 Maximum, minimum, and positive difference functions . 257 7.12.13 Floating multiply-add . 258 7.12.14 Comparison macros . 259 7.13 Nonlocal jumps <setjmp.h> . 262 7.13.1 Save calling environment . 262 7.13.2 Restore calling environment . 263 7.14 Signal handling <signal.h> . 265 7.14.1 Specify signal handling . 266 7.14.2 Send signal . 267 7.15 Alignment <stdalign.h> . 268 7.16 Variable arguments <stdarg.h> . 269 7.16.1 Variable argument list access macros . 269 7.17 Atomics <stdatomic.h> . 273 7.17.1 Introduction . 273 7.17.2 Initialization . 274 7.17.3 Order and consistency . 275 7.17.4 Fences . 278 7.17.5 Lock-free property . 279 7.17.6 Atomic integer types . 280 7.17.7 Operations on atomic types . 282 7.17.8 Atomic flag type and operations . 285 7.18 Boolean type and values <stdbool.h> . 287 7.19 Common definitions <stddef.h> . 288 7.20 Integer types <stdint.h> . 289 vi Contents
ISO/IEC 2011 -All rights reservedISO/IEC9899:2011(E)2897.20.1 Integer types2917.20.2Limits of specified-width integertypes2937.20.3Limits of other integer types2947.20.4Macrosfor integer constants2967.21 Input/output<stdio.h>2967.21.1Introduction7.21.2298Streams7.21.3300Files3027.21.4Operations on files3047.21.5File access functions3097.21.6Formatted input/output functions3307.21.7Character input/output functions3357.21.8Direct input/output functions3367.21.9File positioning functions3387.21.10 Error-handling functions3407.22 General utilities<stdlib.h>3417.22.1Numeric conversion functions3467.22.2Pseudo-random sequence generation functions3477.22.3Memorymanagementfunctions3507.22.4Communication withtheenvironment7.22.5354Searching and sorting utilities3567.22.6Integer arithmetic functions3577.22.7Multibyte/widecharacterconversionfunctions3597.22.8Multibyte/widestringconversionfunctions3617.23Noreturn<stdnoreturn.h>3627.24String handling<string.h>3627.24.1String function conventions3627.24.2Copying functions7.24.3364Concatenationfunctions3657.24.4Comparison functions3677.24.5Searchfunctions3717.24.6Miscellaneousfunctions3737.25 Type-generic math<tgmath.h>3767.26 Threads<threads.h>3767.26.1Introduction3787.26.2Initialization functions3787.26.3Condition variable functions3807.26.4Mutex functions3837.26.5Thread functions3867.26.6Thread-specific storagefunctions3887.27 Date and time<time.h>3887.27.1Components of time3897.27.2Time manipulation functions3927.27.3Time conversion functionsContentsvii
© ISO/IEC 2011 − All rights reserved ISO/IEC 9899:2011 (E) 7.20.1 Integer types . 289 7.20.2 Limits of specified-width integer types . 291 7.20.3 Limits of other integer types . 293 7.20.4 Macros for integer constants . 294 7.21 Input/output <stdio.h> . 296 7.21.1 Introduction . 296 7.21.2 Streams . 298 7.21.3 Files . 300 7.21.4 Operations on files . 302 7.21.5 File access functions . 304 7.21.6 Formatted input/output functions . 309 7.21.7 Character input/output functions . 330 7.21.8 Direct input/output functions . 335 7.21.9 File positioning functions . 336 7.21.10 Error-handling functions . 338 7.22 General utilities <stdlib.h> . 340 7.22.1 Numeric conversion functions . 341 7.22.2 Pseudo-random sequence generation functions . 346 7.22.3 Memory management functions . 347 7.22.4 Communication with the environment . 350 7.22.5 Searching and sorting utilities . 354 7.22.6 Integer arithmetic functions . 356 7.22.7 Multibyte/wide character conversion functions . 357 7.22.8 Multibyte/wide string conversion functions . 359 7.23 _Noreturn <stdnoreturn.h> . 361 7.24 String handling <string.h> . 362 7.24.1 String function conventions . 362 7.24.2 Copying functions . 362 7.24.3 Concatenation functions . 364 7.24.4 Comparison functions . 365 7.24.5 Search functions . 367 7.24.6 Miscellaneous functions . 371 7.25 Type-generic math <tgmath.h> . 373 7.26 Threads <threads.h> . 376 7.26.1 Introduction . 376 7.26.2 Initialization functions . 378 7.26.3 Condition variable functions . 378 7.26.4 Mutex functions . 380 7.26.5 Thread functions . 383 7.26.6 Thread-specific storage functions . 386 7.27 Date and time <time.h> . 388 7.27.1 Components of time . 388 7.27.2 Time manipulation functions . 389 7.27.3 Time conversion functions . 392 Contents vii
ISO/IEC9899:2011(E) ISO/IEC 2011 - All rights reserved3987.28 Unicode utilities<uchar.h>3987.28.1Restartablemultibyte/widecharacterconversionfunctions4027.29 Extended multibyte and wide character utilities <wchar.h>4027.29.1Introduction7.29.2403Formattedwidecharacterinput/outputfunctions4217.29.3Wide character input/output functions4267.29.4General widestringutilities4267.29.4.1 Wide string numeric conversion functions7.29.4.2Wide stringcopyingfunctions4304327.29.4.3Wide string concatenation functions4337.29.4.4Widestringcomparisonfunctions4357.29.4.5 Wide string search functions4397.29.4.6 Miscellaneous functions4397.29.5Wide character time conversion functions4407.29.6Extendedmultibyte/widecharacterconversionutilities4417.29.6.1Single-byte/widecharacterconversionfunctions4417.29.6.2 Conversion state functions7.29.6.3Restartable multibyte/wide character conversion442functions7.29.6.4Restartablemultibyte/wide stringconversion444functions4477.30 Wide characterclassification andmappingutilities<wctype.h>4477.30.1Introduction7.30.2448Widecharacterclassificationutilities4487.30.2.1Widecharacterclassificationfunctions7.30.2.2Extensiblewide character classification451functions4537.30.3Wide character case mapping utilities4537.30.3.1Wide character case mapping functions7.30.3.2Extensiblewidecharactercasemapping453functions4557.31 Future librarydirections4557.31.1Complex arithmetic <complex .h>7.31.2455Character handling<ctype.h>4557.31.3Errors<errno.h>4557.31.4Floating-point environment<fenv.h>4557.31.5Format conversion of integer types<inttypes.h>4557.31.6Localization<locale.h>4557.31.7Signal handling <signal.h>4557.31.8Atomics<stdatomic.h>7.31.9456Boolean type and values<stdbool.h>4567.31.10 Integer types<stdint.h>4567.31.11 Input/output<stdio.h>4567.31.12Generalutilities<std1ib.h>viliContents
ISO/IEC 9899:2011 (E) © ISO/IEC 2011 − All rights reserved 7.28 Unicode utilities <uchar.h> . 398 7.28.1 Restartable multibyte/wide character conversion functions . . 398 7.29 Extended multibyte and wide character utilities <wchar.h> . 402 7.29.1 Introduction . 402 7.29.2 Formatted wide character input/output functions . 403 7.29.3 Wide character input/output functions . 421 7.29.4 General wide string utilities . 426 7.29.4.1 Wide string numeric conversion functions . 426 7.29.4.2 Wide string copying functions . 430 7.29.4.3 Wide string concatenation functions . 432 7.29.4.4 Wide string comparison functions . 433 7.29.4.5 Wide string search functions . 435 7.29.4.6 Miscellaneous functions . 439 7.29.5 Wide character time conversion functions . 439 7.29.6 Extended multibyte/wide character conversion utilities . 440 7.29.6.1 Single-byte/wide character conversion functions . 441 7.29.6.2 Conversion state functions . 441 7.29.6.3 Restartable multibyte/wide character conversion functions . 442 7.29.6.4 Restartable multibyte/wide string conversion functions . 444 7.30 Wide character classification and mapping utilities <wctype.h> . 447 7.30.1 Introduction . 447 7.30.2 Wide character classification utilities . 448 7.30.2.1 Wide character classification functions . 448 7.30.2.2 Extensible wide character classification functions . 451 7.30.3 Wide character case mapping utilities . 453 7.30.3.1 Wide character case mapping functions . 453 7.30.3.2 Extensible wide character case mapping functions . 453 7.31 Future library directions . 455 7.31.1 Complex arithmetic <complex.h> . 455 7.31.2 Character handling <ctype.h> . 455 7.31.3 Errors <errno.h> . 455 7.31.4 Floating-point environment <fenv.h> . 455 7.31.5 Format conversion of integer types <inttypes.h> . 455 7.31.6 Localization <locale.h> . 455 7.31.7 Signal handling <signal.h> . 455 7.31.8 Atomics <stdatomic.h> . 455 7.31.9 Boolean type and values <stdbool.h> . 456 7.31.10 Integer types <stdint.h> . 456 7.31.11 Input/output <stdio.h> . 456 7.31.12 General utilities <stdlib.h> . 456 viii Contents
ISO/IEC 2011 - All rights reservedISO/IEC9899:2011(E)4567.31.13 String handling<string.h>4567.31.14 Dateandtime<time.h>4567.31.15 Threads<threads.h>7.31.16Extended multibyteand wide characterutilities456<wchar.h>7.31.17Widecharacterclassificationandmappingutilities457<wctype.h>458AnnexA(informative)Languagesyntaxsummary458A.1 Lexical grammar465A.2 Phrase structuregrammar473A.3 Preprocessing directives475AnnexB(informative)Librarysummary475B.1Diagnostics<assert.h>B.2475Complex<complex.h>B.3477Character handling<ctype.h>477B.4Errors<errno.h>B.5477Floating-point environment<fenv.h>B.6478Characteristicsoffloatingtypes<f1oat.h>B.7478Format conversion of integer types<inttypes .h>B.8479Alternativespellings<iso646.h>B.9479Sizes of integer types <limits.h>479B.10 Localization<locale.h>479B.11 Mathematics<math.h>484B.12 Nonlocal jumps<setjmp.h>484B.13 Signal handling<signa1.h>485B.14 Alignment<stdalign.h>485B.15 Variable arguments<stdarg.h>485B.16Atomics<stdatomic.h>487B.17 Boolean type and values<stdbool.h>487B.18 Common definitions<stddef.h>487B.19 Integertypes<stdint.h>488B.20 Input/output<stdio.h>491B.21 General utilities<stdlib.h>493B.22.Noreturn<stdnoreturn.h>493B.23 String handling<string.h>495B.24 Type-generic math<tgmath.h>495B.25 Threads<threads.h>496B.26 Dateand time<time.h>497B.27 Unicode utilities<uchar.h>497B.28 Extendedmultibyte/wide character utilities<wchar.h>502B.29 Wide character classification and mapping utilities<wctype.h>503Annex C (informative) Sequence pointsixContents
© ISO/IEC 2011 − All rights reserved ISO/IEC 9899:2011 (E) 7.31.13 String handling <string.h> . 456 7.31.14 Date and time <time.h> . 456 7.31.15 Threads <threads.h> . 456 7.31.16 Extended multibyte and wide character utilities <wchar.h> . 456 7.31.17 Wide character classification and mapping utilities <wctype.h> . 457 Annex A (informative) Language syntax summary . 458 A.1 Lexical grammar . 458 A.2 Phrase structure grammar . 465 A.3 Preprocessing directives . 473 Annex B (informative) Library summary . 475 B.1 Diagnostics <assert.h> . 475 B.2 Complex <complex.h> . 475 B.3 Character handling <ctype.h> . 477 B.4 Errors <errno.h> . 477 B.5 Floating-point environment <fenv.h> . 477 B.6 Characteristics of floating types <float.h> . 478 B.7 Format conversion of integer types <inttypes.h> . 478 B.8 Alternative spellings <iso646.h> . 479 B.9 Sizes of integer types <limits.h> . 479 B.10 Localization <locale.h> . 479 B.11 Mathematics <math.h> . 479 B.12 Nonlocal jumps <setjmp.h> . 484 B.13 Signal handling <signal.h> . 484 B.14 Alignment <stdalign.h> . 485 B.15 Variable arguments <stdarg.h> . 485 B.16 Atomics <stdatomic.h> . 485 B.17 Boolean type and values <stdbool.h> . 487 B.18 Common definitions <stddef.h> . 487 B.19 Integer types <stdint.h> . 487 B.20 Input/output <stdio.h> . 488 B.21 General utilities <stdlib.h> . 491 B.22 _Noreturn <stdnoreturn.h> . 493 B.23 String handling <string.h> . 493 B.24 Type-generic math <tgmath.h> . 495 B.25 Threads <threads.h> . 495 B.26 Date and time <time.h> . 496 B.27 Unicode utilities <uchar.h> . 497 B.28 Extended multibyte/wide character utilities <wchar.h> . 497 B.29 Wide character classification and mapping utilities <wctype.h> . 502 Annex C (informative) Sequence points . 503 Contents ix
ISO/IEC9899:2011(E)ISO/IEC 2011 - All rights reserved504Annex D (normative)Universal character names for identifiers504D.1Rangesofcharactersallowed504D.2 Ranges of characters disallowed initially505AnnexE(informative)Implementationlimits507AnnexF(normative)IEC60559floating-pointarithmetic507F.1IntroductionF.2507TypesF.3508OperatorsandfunctionsF.4510Floating to integer conversionF.5510Binary-decimal conversionF.6511The return statementF.7511Contracted expressionsF.8511Floating-point environmentF.9514Optimization517F.10Mathematics<math.h>518F.10.1Trigonometric functions520F.10.2Hyperbolic functionsF.10.3520Exponential and logarithmic functionsF.10.4524Power and absolute value functions525F.10.5Errorandgammafunctions526F.10.6Nearest integer functions528F.10.7Remainder functions529F.10.8Manipulation functions530F.10.9Maximum,minimum,and positivedifferencefunctions530F.10.10 Floating multiply-add531F.10.11 Comparisonmacros532AnnexG(normative)IEC60559-compatiblecomplexarithmetic532G.1IntroductionG.2 532TypesG.3532Conventions533G.4Conversions533G.4.1Imaginarytypes533G.4.2Real and imaginary533G.4.3Imaginary and complex533G.5Binary operators534G.5.1Multiplicative operatorsG.5.2537Additive operators537G.6Complexarithmetic<complex.h>539G.6.1Trigonometric functionsG.6.2539Hyperbolic functions543G.6.3Exponential and logarithmic functions544G.6.4Powerandabsolute-valuefunctionsG.7545Type-generic math<tgmath.h>XContents
ISO/IEC 9899:2011 (E) © ISO/IEC 2011 − All rights reserved Annex D (normative) Universal character names for identifiers . 504 D.1 Ranges of characters allowed . 504 D.2 Ranges of characters disallowed initially . 504 Annex E (informative) Implementation limits . 505 Annex F (normative) IEC 60559 floating-point arithmetic . 507 F.1 Introduction . 507 F.2 Types . 507 F.3 Operators and functions . 508 F.4 Floating to integer conversion . 510 F.5 Binary-decimal conversion . 510 F.6 The return statement . 511 F.7 Contracted expressions . 511 F.8 Floating-point environment . 511 F.9 Optimization . 514 F.10 Mathematics <math.h> . 517 F.10.1 Trigonometric functions . 518 F.10.2 Hyperbolic functions . 520 F.10.3 Exponential and logarithmic functions . 520 F.10.4 Power and absolute value functions . 524 F.10.5 Error and gamma functions . 525 F.10.6 Nearest integer functions . 526 F.10.7 Remainder functions . 528 F.10.8 Manipulation functions . 529 F.10.9 Maximum, minimum, and positive difference functions . 530 F.10.10 Floating multiply-add . 530 F.10.11 Comparison macros . 531 Annex G (normative) IEC 60559-compatible complex arithmetic . 532 G.1 Introduction . 532 G.2 Types . 532 G.3 Conventions . 532 G.4 Conversions . 533 G.4.1 Imaginary types . 533 G.4.2 Real and imaginary . 533 G.4.3 Imaginary and complex . 533 G.5 Binary operators . 533 G.5.1 Multiplicative operators . 534 G.5.2 Additive operators . 537 G.6 Complex arithmetic <complex.h> . 537 G.6.1 Trigonometric functions . 539 G.6.2 Hyperbolic functions . 539 G.6.3 Exponential and logarithmic functions . 543 G.6.4 Power and absolute-value functions . 544 G.7 Type-generic math <tgmath.h> . 545 x Contents