Information technology — Programming languages — C

1 This document specifies the form and establishes the interpretation of programs written in the C programming language.1) It specifies - the representation of C programs; - the syntax and constraints of the C language; - the semantic rules for interpreting C programs; - the representation of input data to be processed by C programs; - the representation of output data produced by C programs; - the restrictions and limits imposed by a conforming implementation of C. 2 This document does not specify - the mechanism by which C programs are transformed for use by a data-processing system; - the mechanism by which C programs are invoked for use by a data-processing system; - the mechanism by which input data are transformed for use by a C program; - the mechanism by which output data are transformed after being produced by a C program; - the size or complexity of a program and its data that will exceed the capacity of any specific data-processing system or the capacity of a particular processor; - all minimal requirements of a data-processing system that is capable of supporting a conforming implementation.

Technologies de l'information — Langages de programmation — C

General Information

Status
Published
Publication Date
04-Jul-2018
Current Stage
9093 - International Standard confirmed
Completion Date
14-Jul-2024
Ref Project

Relations

Buy Standard

Standard
ISO/IEC 9899:2018 - Information technology — Programming languages — C Released:7/5/2018
English language
520 pages
sale 15% off
Preview
sale 15% off
Preview
Standard
ISO/IEC 9899:2018 - Information technology -- Programming languages -- C
English language
520 pages
sale 15% off
Preview
sale 15% off
Preview

Standards Content (Sample)


INTERNATIONAL ISO/IEC
STANDARD 9899
Fourth edition
2018-07
Information technology —
Programming languages — C
Technologies de l'information — Langages de programmation — C
Reference number
©
ISO/IEC 2018
© ISO/IEC 2018
All rights reserved. Unless otherwise specified, or required in the context of its implementation, no part of this publication may
be reproduced or utilized otherwise in any form or by any means, electronic or mechanical, including photocopying, or posting
on the internet or an intranet, without prior written permission. Permission can be requested from either ISO at the address
below or ISO’s member body in the country of the requester.
ISO copyright office
CP 401 • Ch. de Blandonnet 8
CH-1214 Vernier, Geneva
Phone: +41 22 749 01 11
Fax: +41 22 749 09 47
Email: copyright@iso.org
Website: www.iso.org
Published in Switzerland
ii © ISO/IEC 2018 – All rights reserved

© ISO/IEC 2018– All rights reserved ISO/IEC 9899:2018 (E)
Contents
Foreword xi
Introduction xii
1 Scope
2 Normative references 2
3 Terms, definitions and symbols 3
4 Conformance
5 Environment 9
5.1 Conceptual models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
5.1.1 Translation environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
5.1.2 Execution environments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
5.2 Environmental considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
5.2.1 Character sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
5.2.2 Character display semantics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
5.2.3 Signals and interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
5.2.4 Environmental limits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
6 Language 28
6.1 Notation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
6.2 Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
6.2.1 Scopes of identifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
6.2.2 Linkages of identifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
6.2.3 Name spaces of identifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
6.2.4 Storage durations of objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
6.2.5 Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
6.2.6 Representations of types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
6.2.7 Compatible type and composite type . . . . . . . . . . . . . . . . . . . . . . . 35
6.2.8 Alignment of objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
6.3 Conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
6.3.1 Arithmetic operands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
6.3.2 Other operands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
6.4 Lexical elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
6.4.1 Keywords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
6.4.2 Identifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Contents iii
6.4.3 Universal character names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
6.4.4 Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
6.4.5 String literals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
6.4.6 Punctuators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
6.4.7 Header names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
6.4.8 Preprocessing numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
6.4.9 Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
6.5 Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
6.5.1 Primary expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
6.5.2 Postfix operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
6.5.3 Unary operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
6.5.4 Cast operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
6.5.5 Multiplicative operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
6.5.6 Additive operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
6.5.7 Bitwise shift operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
6.5.8 Relational operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
6.5.9 Equality operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
6.5.10 Bitwise AND operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
6.5.11 Bitwise exclusive OR operator . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
6.5.12 Bitwise inclusive OR operator . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
6.5.13 Logical AND operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
6.5.14 Logical OR operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
6.5.15 Conditional operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
6.5.16 Assignment operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
6.5.17 Comma operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
6.6 Constant expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
6.7 Declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
6.7.1 Storage-class specifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
6.7.2 Type specifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
6.7.3 Type qualifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
6.7.4 Function specifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
6.7.5 Alignment specifier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
6.7.6 Declarators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
6.7.7 Type names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
6.7.8 Type definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
6.7.9 Initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
6.7.10 Static assertions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
6.8 Statements and blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
6.8.1 Labeled statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
6.8.2 Compound statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
iv Contents
© ISO/IEC 2018– All rights reserved ISO/IEC 9899:2018 (E)
6.8.3 Expression and null statements . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
6.8.4 Selection statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
6.8.5 Iteration statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
6.8.6 Jump statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
6.9 External definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
6.9.1 Function definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
6.9.2 External object definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
6.10 Preprocessing directives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
6.10.1 Conditional inclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
6.10.2 Source file inclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
6.10.3 Macro replacement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
6.10.4 Line control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
6.10.5 Error directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
6.10.6 Pragma directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
6.10.7 Null directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
6.10.8 Predefined macro names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
6.10.9 Pragma operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
6.11 Future language directions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
6.11.1 Floating types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
6.11.2 Linkages of identifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
6.11.3 External names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
6.11.4 Character escape sequences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
6.11.5 Storage-class specifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
6.11.6 Function declarators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
6.11.7 Function definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
6.11.8 Pragma directives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
6.11.9 Predefined macro names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
7 Library 131
7.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
7.1.1 Definitions of terms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
7.1.2 Standard headers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
7.1.3 Reserved identifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
7.1.4 Use of library functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
7.2 Diagnostics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
7.2.1 Program diagnostics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
7.3 Complex arithmetic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
7.3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
7.3.2 Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
7.3.3 Branch cuts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
Contents v
_ _
7.3.4 TheCX LIMITED RANGE pragma . . . . . . . . . . . . . . . . . . . . . . . . . . 137
7.3.5 Trigonometric functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
7.3.6 Hyperbolic functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
7.3.7 Exponential and logarithmic functions . . . . . . . . . . . . . . . . . . . . . . 140
7.3.8 Power and absolute-value functions . . . . . . . . . . . . . . . . . . . . . . . . 141
7.3.9 Manipulation functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
7.4 Character handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
7.4.1 Character classification functions . . . . . . . . . . . . . . . . . . . . . . . . . . 145
7.4.2 Character case mapping functions . . . . . . . . . . . . . . . . . . . . . . . . . 147
7.5 Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
7.6 Floating-point environment . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
_
7.6.1 TheFENV ACCESS pragma . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
7.6.2 Floating-point exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
7.6.3 Rounding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
7.6.4 Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
7.7 Characteristics of floating types . . . . . . . . . . . . . . . . . . . . . . . . 157
7.8 Format conversion of integer types . . . . . . . . . . . . . . . . . . . . 158
7.8.1 Macros for format specifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
7.8.2 Functions for greatest-width integer types . . . . . . . . . . . . . . . . . . . . 159
7.9 Alternative spellings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
7.10 Sizes of integer types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
7.11 Localization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
7.11.1 Locale control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
7.11.2 Numeric formatting convention inquiry . . . . . . . . . . . . . . . . . . . . . . 164
7.12 Mathematics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
7.12.1 Treatment of error conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
_
7.12.2 TheFP CONTRACT pragma . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
7.12.3 Classification macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
7.12.4 Trigonometric functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
7.12.5 Hyperbolic functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
7.12.6 Exponential and logarithmic functions . . . . . . . . . . . . . . . . . . . . . . 177
7.12.7 Power and absolute-value functions . . . . . . . . . . . . . . . . . . . . . . . . 180
7.12.8 Error and gamma functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
7.12.9 Nearest integer functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183
7.12.10 Remainder functions . . . . . . . . . . . . . .
...


INTERNATIONAL ISO/IEC
STANDARD 9899
Fourth edition
2018-07
Information technology —
Programming languages — C
Technologies de l'information — Langages de programmation — C
Reference number
©
ISO/IEC 2018
© ISO/IEC 2018
All rights reserved. Unless otherwise specified, or required in the context of its implementation, no part of this publication may
be reproduced or utilized otherwise in any form or by any means, electronic or mechanical, including photocopying, or posting
on the internet or an intranet, without prior written permission. Permission can be requested from either ISO at the address
below or ISO’s member body in the country of the requester.
ISO copyright office
CP 401 • Ch. de Blandonnet 8
CH-1214 Vernier, Geneva
Phone: +41 22 749 01 11
Fax: +41 22 749 09 47
Email: copyright@iso.org
Website: www.iso.org
Published in Switzerland
ii © ISO/IEC 2018 – All rights reserved

© ISO/IEC 2018– All rights reserved ISO/IEC 9899:2018 (E)
Contents
Foreword xi
Introduction xii
1 Scope
2 Normative references 2
3 Terms, definitions and symbols 3
4 Conformance
5 Environment 9
5.1 Conceptual models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
5.1.1 Translation environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
5.1.2 Execution environments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
5.2 Environmental considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
5.2.1 Character sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
5.2.2 Character display semantics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
5.2.3 Signals and interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
5.2.4 Environmental limits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
6 Language 28
6.1 Notation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
6.2 Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
6.2.1 Scopes of identifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
6.2.2 Linkages of identifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
6.2.3 Name spaces of identifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
6.2.4 Storage durations of objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
6.2.5 Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
6.2.6 Representations of types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
6.2.7 Compatible type and composite type . . . . . . . . . . . . . . . . . . . . . . . 35
6.2.8 Alignment of objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
6.3 Conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
6.3.1 Arithmetic operands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
6.3.2 Other operands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
6.4 Lexical elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
6.4.1 Keywords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
6.4.2 Identifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Contents iii
6.4.3 Universal character names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
6.4.4 Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
6.4.5 String literals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
6.4.6 Punctuators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
6.4.7 Header names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
6.4.8 Preprocessing numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
6.4.9 Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
6.5 Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
6.5.1 Primary expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
6.5.2 Postfix operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
6.5.3 Unary operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
6.5.4 Cast operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
6.5.5 Multiplicative operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
6.5.6 Additive operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
6.5.7 Bitwise shift operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
6.5.8 Relational operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
6.5.9 Equality operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
6.5.10 Bitwise AND operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
6.5.11 Bitwise exclusive OR operator . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
6.5.12 Bitwise inclusive OR operator . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
6.5.13 Logical AND operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
6.5.14 Logical OR operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
6.5.15 Conditional operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
6.5.16 Assignment operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
6.5.17 Comma operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
6.6 Constant expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
6.7 Declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
6.7.1 Storage-class specifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
6.7.2 Type specifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
6.7.3 Type qualifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
6.7.4 Function specifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
6.7.5 Alignment specifier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
6.7.6 Declarators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
6.7.7 Type names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
6.7.8 Type definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
6.7.9 Initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
6.7.10 Static assertions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
6.8 Statements and blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
6.8.1 Labeled statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
6.8.2 Compound statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
iv Contents
© ISO/IEC 2018– All rights reserved ISO/IEC 9899:2018 (E)
6.8.3 Expression and null statements . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
6.8.4 Selection statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
6.8.5 Iteration statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
6.8.6 Jump statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
6.9 External definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
6.9.1 Function definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
6.9.2 External object definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
6.10 Preprocessing directives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
6.10.1 Conditional inclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
6.10.2 Source file inclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
6.10.3 Macro replacement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
6.10.4 Line control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
6.10.5 Error directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
6.10.6 Pragma directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
6.10.7 Null directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
6.10.8 Predefined macro names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
6.10.9 Pragma operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
6.11 Future language directions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
6.11.1 Floating types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
6.11.2 Linkages of identifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
6.11.3 External names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
6.11.4 Character escape sequences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
6.11.5 Storage-class specifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
6.11.6 Function declarators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
6.11.7 Function definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
6.11.8 Pragma directives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
6.11.9 Predefined macro names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
7 Library 131
7.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
7.1.1 Definitions of terms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
7.1.2 Standard headers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
7.1.3 Reserved identifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
7.1.4 Use of library functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
7.2 Diagnostics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
7.2.1 Program diagnostics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
7.3 Complex arithmetic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
7.3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
7.3.2 Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
7.3.3 Branch cuts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
Contents v
_ _
7.3.4 TheCX LIMITED RANGE pragma . . . . . . . . . . . . . . . . . . . . . . . . . . 137
7.3.5 Trigonometric functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
7.3.6 Hyperbolic functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
7.3.7 Exponential and logarithmic functions . . . . . . . . . . . . . . . . . . . . . . 140
7.3.8 Power and absolute-value functions . . . . . . . . . . . . . . . . . . . . . . . . 141
7.3.9 Manipulation functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
7.4 Character handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
7.4.1 Character classification functions . . . . . . . . . . . . . . . . . . . . . . . . . . 145
7.4.2 Character case mapping functions . . . . . . . . . . . . . . . . . . . . . . . . . 147
7.5 Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
7.6 Floating-point environment . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
_
7.6.1 TheFENV ACCESS pragma . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
7.6.2 Floating-point exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
7.6.3 Rounding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
7.6.4 Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
7.7 Characteristics of floating types . . . . . . . . . . . . . . . . . . . . . . . . 157
7.8 Format conversion of integer types . . . . . . . . . . . . . . . . . . . . 158
7.8.1 Macros for format specifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
7.8.2 Functions for greatest-width integer types . . . . . . . . . . . . . . . . . . . . 159
7.9 Alternative spellings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
7.10 Sizes of integer types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
7.11 Localization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
7.11.1 Locale control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
7.11.2 Numeric formatting convention inquiry . . . . . . . . . . . . . . . . . . . . . . 164
7.12 Mathematics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
7.12.1 Treatment of error conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
_
7.12.2 TheFP CONTRACT pragma . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
7.12.3 Classification macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
7.12.4 Trigonometric functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
7.12.5 Hyperbolic functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
7.12.6 Exponential and logarithmic functions . . . . . . . . . . . . . . . . . . . . . . 177
7.12.7 Power and absolute-value functions . . . . . . . . . . . . . . . . . . . . . . . . 180
7.12.8 Error and gamma functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
7.12.9 Nearest integer functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183
7.12.10 Remainder functions . . . . . . . . . . . . . .
...

Questions, Comments and Discussion

Ask us and Technical Secretary will try to provide an answer. You can facilitate discussion about the standard in here.