ISO/IEC 9899:1990
(Main)Programming languages — C
Programming languages — C
Langages de programmation — C
General Information
Relations
Standards Content (Sample)
INTERNATIONAL
ISOIIEC
STANDARD
First edition
1990-12-15
Programming languages - C
Langages de programmation - C
w
E
-
-
=
= E
=
=
=
=
= =
= z
z
= =
=
=.
s
= =
-
C Reference number
E Z
E-
-
ISOAEC 9899 : 1990 (El
ISO/IEC 9899: 1990 (E)
Contents
1 Scope . . . . . . . . . . . . . . . . . . . . . . . . . . .
2 Normative references . . . . . . . . . . . . . . . . . . . . . .
3 Definitions and conventions . . . . . . . . . . . . . . . . . . . .
4 Compliance . . . . . . . . . . . . . . . . . . . . . . . . .
.........................
5 Environment
.....................
5.1 Conceptual models
.................
51.1 Translation environment
.................
51.2 Execution environments
..................
5.2 Environmental considerations
....................
5.2.1 Character sets
................
5.2.2 Character display semantics
..................
5.2.3 Signals and interrupts
..................
5.2.4 Environmental limits
..........................
6 Language
......................
6.1 Lexical elements
.....................
6.1.1 Keywords
.....................
6.1.2 Identifiers
....................
6.1.3 Constants
.....................
6.1.4 String literals
6.1.5 Operators .
6.1.6 Punctuators .
6.1.7 Header names .
6.1.8 Preprocessing numbers .
.....................
6.1.9 Comments
.......................
6.2 Conversions
..................
6.2.1 Arithmetic operands
....................
6.2.2 Other operands
.......................
6.3 Expressions
..................
6.3.1 Primary expressions
...................
6.3.2 Postfix operators
....................
Unary operators
6.3.3
Cast operators .
6.3.4
.................
6.3.5 Multiplicative operators
...................
6.3.6 Additive operators
..................
6.3.7 Bitwise shift operators
..................
6.3.8 Relational operators
...................
Equality operators
6.3.9
..................
Bitwise AND operator
6.3.10
...............
6.3.11 Bitwise exclusive OR operator
...............
6.3.12 Bitwise inclusive OR operator
..................
6.3.13 Logical AND operator
..................
6.3.14 Logical OR operator
..................
6.3.15 Conditional operator
0 ISO/IEC 1990
All rights reserved. No part of this publication may be reproduced or utilized in any form or by
any means, electronic or mechanical, including photocopying and microfilm, without permission
in writing from the publisher.
ISO/IEC Copyright Office l Case postale 56 l CH-1211 Geneve 20 l Switzerland
Printed in Switzerland
ii
ISO/IEC 9899: 1990 (E)
. . . . . . . . 53
6.3.16 Assignment operators . . . . . . . . . .
. . . . . 54
6.3.17 Comma operator . . . . . . . . . . . . . .
.
. . . . . 55
Constant expressions . . . . . . . . . . . . . . .
6.4
. . . . . 57
Declarations . . . . . . . . . . . . . . . . .
6.5
. . . . . 58
6.5.1 Storage-class specifiers . . . . . . . . . . .
. . . . . 58
6.5.2 Type specifiers . . . . . . . . . . . . . .
. . 64
. . . . . . . . . .
6.5.3 Type qualifiers . . . . .
. . . . . . . 65
. . . l . . .
6.5.4 Declarators . . . . . .
. . . . . . 69
. . . . . . . . .
6.5.5 Type names . . . . . .
. . . . . 70
. . . . . . . . . .
6.5.6 Type definitions . . . .
. . . 71
. . . . . . . . . .
6.5.7 Initialization . . . . . .
. . . . 75
. . . . . . . . . . .
6.6 Statements . . . . . . . . .
. . . . 75
. . . . . . . . . . .
6.6.1 Labeled statements . . . .
.... . . 75
. . . . . . . . .
6.6.2 Compound statement, or block
. 76
. . . . . . . . . . . .
6.6.3 Expression and null statements
. . . . . . . . . . . . .
6.6.4 Selection statements . . .
. . . . . . . . . . . .
6.6.5 Iteration statements . . .
. . . . . . . . . . . .
6.6.6 Jump statements . . . .
. . . . . . . . . . . . .
6.7 External definitions . . . . . .
. . . . . . . . . . . . .
6.7.1 Function definitions
. . . . . . . . . . . . . . .
6.7.2 External object definitions l .
. . . . . . . . . . . . . . .
6.8 Preprocessing directives
. . . . . . . . . . . .
6.8.1 Conditional inclusion . . .
I*
. . . . . . . . . . . .
6.8.2 Source file inclusion . . .
. . . . . . . . . . . .
6.8.3 Macro replacement . . . .
. . . . . . . . . . . .
6.8.4 Line control . . . . . .
. . . . . . . . . . . . .
6.8.5 Error directive . . . . .
. . . . . . . . . . . .
6.8.6 Pragma directive . . . .
. . . . . . . . . . . . .
6.8.7 Null directive
. . . . . . . . . . . . . .
6.8.8 Predefined macro ’names’ . .
. . . . . . . . . . . .
6.9 Future language directions . . . .
. . . . . . . . . . .
6.9.1 External names . . . . .
. . . . . . . . . . .
6.9.2 Character escape sequences .
. . . . . . . . . . . .
6.9.3 Storage-class specifiers . .
. . . . . . . . . . . .
6.9.4 Function declarators . . .
. . . . . . . . . . . . . .
6.9.5 Function definitions . . .
. . . . . . . . . . . .
6.9.6 Array parameters . . . .
. . . . . . . . . . . . . .
7 Library . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . 96
7.1 Introduction
. . . . . . . . . . . 96
7.1.1 Definitibns ’of ‘terms ’ . . . .
. . . . . . . . . . . . . . 96
7.1.2 Standard headers . . . . .
. . . . . . . . . . . . 97
7.1.3 Reserved identifiers . . . .
. . . . . . . . . . . . . . 97
7.1.4 Errors . . . .
..... .' ...... 98
7.1.5 Limits and
............. 98
7.1.6 Common definitions
7.1.7 Use of library functions .
7.2 Diagnostics .
7.2.1 Program diagnostics .
h> .
7.3 Character handling
................
7.3.1 Character testing functions
..............
7.3.2 Character case mapping functions
..................
7.4 Localization
....................
7.4.1 Locale control
............
7.4.2 Numeric formatting convention inquiry
. . .
ISO/IEC 9899: 1990 (E)
7.5 Mathematics .
...............
7.5.1 Treatment of error conditions
.................
7.5.2 Trigonometric functions
7.5.3 Hyperbolic functions .
.............
7.5.4 Exponential and logarithmic functions
. . 115
.....
7.5.5 Power functions
.......
7.5.6 Nearest integer, absoke value, and rem ’ainder ’fun ’ctions’
.................
7.6 Nonlocaljumps
.................
7.6.1 Save calling environment
................
7.6.2 Restore calling environment
.................
7.7 Signal handling
.................
7.7.1 Specify signal handling
.....................
7.7.2 Send signal
h> .
7.8 Variable arguments
.............
7.8.1 Variable argument list access macros
...................
7.9 Input/output
.....................
7.9.1 Introduction
......................
7.9.2 Streams
.......................
7.9.3 Files
...................
7.9.4 Operations on files
..................
7.9.5 File access functions
..............
7.9.6 Formatted input/output functions
...............
7.9.7 Character input/output functions
................
7.9.8 Direct input/output functions
.................
7.9.9 File positioning functions
.................
7.9.10 Error-handling functions
.................
7.10 General utilities <&dlib.h>
................
7.10.1 String conversion functions
..........
7.10.2 Pseudo-random sequence generation functions
...............
7.10.3 Memory management functions
.............
7.10.4 Communication with the environment
...............
7.10.5 Searching and sorting utilities
................
7.10.6 Integer arithmetic functions
...............
7.10.7 Multibyte character functions
................
7.10.8 Multibyte string functions
.................
7.11 String handling
................
7.11.1 String function conventions
...................
7.11.2 Copying functions
.................
7.11.3 Concatenation functions
..................
7.11.4 Comparison functions
. . .
. . . . .
7.11.5 Search functions
. .
7.11.6 Miscellaneous functions’
....................
7.12 Dateandtime
..................
7.12.1 Components of time
................
7.12.2 Time manipulation functions
................
7.12.3 Time conversion functions
...................
7.13 Future library directions
..................
7.13.1 Errors
..............
. h>
7.13.2 Character handling
................
7.13.3 Localization
.................
7.13.4 Mathematics
...............
7.13.5 Signal handling
...............
7.13.6 Input/output
...............
7.13.7 General utilities
...............
7.13.8 String handling
iv
ISO/IEC 9899: 1990 (E)
Annexes
. . . . . .
............. . . . . .
A Bibliography
. . . . .
......... . e . .
B Language syntax summary
. . . .
.......... . . . .
B.1 Lexical grammar
. . . . . 182
....... . . . .
B.2 Phrase structure grammar
. . . . . 187
....... . . .
B.3 Preprocessing directives
. . . . . . . 189
............ . . .
C Sequence points
. . . . . 190
........... . .
D Library summary
. . . . 190
. . . . . . .
D.1 Errors . . . . .
. . . 190
. . . . . . . .
D.2 Common definitions
. . . . 190
. . . . . . .
D.3 Diagnostics . .
. . . . . 190
. . . . . . . .
D.4 Character handling
. . . 190
. . . . . . . .
D.5 Localization . .
. . . . . .
. . . . . .
D.6 Mathematics . . .
. . . . . . 191
. . . . . . . .
D.7 Nonlocal jumps
. . . . . . 191
. . . . . . .
D.8 Signal handling
. . . . . . . 192
. . . . . .
D.9 Variable arguments
. . . . . .
. . . . .
D.10 Input/output . . .
. . . . . . . 194
. . . . . .
D.11 General utilities
. . . . . . . 195
. . . . . .
D.12 String handling
. . . . . . . . 195
. . . . .
D.13 Date and time . . .
. . . . . . . . . . 196
E Implementation limits . . . . . . . . . l
. . . . . . . . 198
.
F Common warnings . . . . . . . . . . .
. . . . . . . 199
............ . .
G Portability issues
. . . . .
........ .
G.l Unspecified behavior
. . . . . . .
......... .
G.2 Undefined behavior
. . . .
..... . .
G.3 Implementation-defined behavior
. 207
. . . . . . .
....... .
G.4 Locale-specific behavior
. . . . .
......... . .
G.5 Common extensions
. . . . . .
Index . . . . . . . . . . . . . . . . -
ISO/IEC 9899: 1990 (E)
Foreword
IS0 (the International Organization for Standardization) and IEC (the International
Electrotechnical Commission) form the specialized system for worldwide standardiz-
ation. National bodies that are members of IS0 or IEC participate in the development
of International Standards through technical committees established by the respective
organization to deal with particular fields of technical activity. IS0 and IEC technical
committees collaborate in fields of mutual interest. Other international organizations,
governmental and non-governmental, in liaison with IS0 and IEC, also take part in the
work.
In the field of information technology, IS0 and IEC have established a joint technical
committee, ISO/IEC JTC 1. Draft International Standards adopted by the joint
technical committee are circulated to national bodies for voting. Publication as an
International Standard requires approval by at least 75 ?70 of the national bodies casting
a vote.
International Standard ISO/IEC 9899 was prepared by Joint Technical Committee
ISO/IEC JTC 1, Information technology.
Annexes A, B, C, D, E, F and G are for information only.
vi
ISO/IEC 9899: 1990 (E)
Introduction
With the introduction of new devices and extended character sets, new features may be added to
this International Standard. Subclauses in the language and library clauses warn implementors and
programmers of usages which, though valid in themselves, may conflict with future additions.
Certain features are obsolescent, which means that they may be considered for withdrawal in future
revisions of this International Standard. They are retained because of their widespread use, but their
use in new implementations (for implementation features) or new programs (for language [6.9] or
library features [7.13]) is discouraged.
This International Standard is divided into four major subdivisions:
- the introduction and preliminary elements;
- the characteristics of environments that translate and execute C programs;
- the language syntax, constraints, and semantics;
- the library facilities.
Examples are provided to illustrate possible forms of the constructions described. Footnotes are
provided to emphasize consequences of the rules described in that subclause or elsewhere in this
International Standard. References are used to refer to other related subclauses. A set of annexes
summarizes information contained in this International Standard. The introduction, the examples, the
footnotes, the references, and the annexes are not part of this International Standard.
The language clause (clause 7) is derived from ‘ ‘The C Reference Manual” (see annex A).
The library clause (clause 8) is based on the 1984 lusr-/group Standard (see annex A).
vii
This page intentionally left blank
INTERNATIONAL STANDARD
ISO/IEC 9899 : 1990 (E)
Programming languages - C
1 Scope
This International Standard specifies the form and establishes the interpretation of programs
written in the C programming language.’ It specifies
- the representation of C programs;
- the syntax and constraints of the C language;
- the semantic rules for interpreting
...
Questions, Comments and Discussion
Ask us and Technical Secretary will try to provide an answer. You can facilitate discussion about the standard in here.