Reference number
ISO/IEC 9899:1999(E)
©
ISO/IEC 1999
INTERNATIONAL
STANDARD
ISO/IEC
9899
Second edition
1999-12-01
Programming languages — C
Langages de programmation — C
Processed and adopted by ASC the National Committee for
Information Technology Standards (NCITS) and approved by
ANSI as an American National Standard.
Date of ANSI Approval: 5/22/2000
Published by American National Standards Institute,
11 West 42nd Street, New York, New York 10036
Copyright 2000 by Information Technology Industry Council
(ITI). All rights reserved.
These materials are subject to copyright claims of International
Standardization Organization (ISO), International Electrotechnical
Commission (IEC), American National Standards Institute (ANSI),
and Information Technology Industry Council (ITI). Not for resale.
No part of this publication may be reproduced in any form,
including an electronic retrieval system, without the prior written
permission of ITI. All requests pertaining to this standard should be
submitted to ITI, 1250 Eye Street NW, Washington, DC 20005.
Printed in the United States of America
ISO/IEC 9899:1999(E)
PDF disclaimer
This PDF file may contain embedded typefaces. In accordance with Adobe's licensing policy, this file may be printed or viewed but shall not
be edited unless the typefaces which are embedded are licensed to and installed on the computer performing the editing. In downloading this
file, parties accept therein the responsibility of not infringing Adobe's licensing policy. The ISO Central Secretariat accepts no liability in this
area.
Adobe is a trademark of Adobe Systems Incorporated.
Details of the software products used to create this PDF file can be found in the General Info relative to the file; the PDF-creation parameters
were optimized for printing. Every care has been taken to ensure that the file is suitable for use by ISO member bodies. In the unlikely event
that a problem relating to it is found, please inform the Central Secretariat at the address given below.
© ISO/IEC 1999
All rights reserved. Unless otherwise specified, 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 either ISO at the address below or ISO's member body
in the country of the requester.
ISO copyright office
Case postale 56 · CH-1211 Geneva 20
Tel. + 41 22 749 01 11
Fax + 41 22 734 10 79
E-mail copyright@iso.ch
Web www.iso.ch
Printed in Switzerland
ii © ISO/IEC 1999 – All rights reserved
©ISO/IEC ISO/IEC 9899:1999 (E)
Contents
Foreword ............................. xi
Introduction ............................ xiv
1. Scope ............................. 1
2. Normative references ....................... 2
3. Terms, definitions, and symbols ................... 3
4. Conformance .......................... 7
5. Environment .......................... 9
5.1 Conceptual models ..................... 9
5.1.1 Translation environment ................ 9
5.1.2 Execution environments ................ 11
5.2 Environmental considerations ................. 17
5.2.1 Character sets .................... 17
5.2.2 Character display semantics .............. 19
5.2.3 Signals and interrupts ................. 20
5.2.4 Environmental limits ................. 20
6. Language ............................ 29
6.1 Notation .......................... 29
6.2 Concepts ......................... 29
6.2.1 Scopes of identifiers ................. 29
6.2.2 Linkages of identifiers ................. 30
6.2.3 Name spaces of identifiers ............... 31
6.2.4 Storage durations of objects .............. 32
6.2.5 Types ....................... 33
6.2.6 Representations of types ................ 37
6.2.7 Compatible type and composite type ........... 40
6.3 Conversions ........................ 42
6.3.1 Arithmetic operands ................. 42
6.3.2 Other operands ................... 46
6.4 Lexical elements ...................... 49
6.4.1 Keywords ...................... 50
6.4.2 Identifiers ...................... 51
6.4.3 Universal character names ............... 53
6.4.4 Constants ...................... 54
6.4.5 String literals .................... 62
6.4.6 Punctuators ..................... 63
6.4.7 Header names .................... 64
6.4.8 Preprocessing numbers ................ 65
6.4.9 Comments ..................... 66
6.5 Expressions ........................ 67
Contents iii
ISO/IEC 9899:1999 (E) ©ISO/IEC
6.5.1 Primary expressions ................. 69
6.5.2 Postfix operators ................... 69
6.5.3 Unary operators ................... 78
6.5.4 Cast operators .................... 81
6.5.5 Multiplicative operators ................ 82
6.5.6 Additive operators .................. 82
6.5.7 Bitwise shift operators ................. 84
6.5.8 Relational operators .................. 85
6.5.9 Equality operators .................. 86
6.5.10 Bitwise
AND operator ................. 87
6.5.11 Bitwise exclusive
OR operator ............. 88
6.5.12 Bitwise inclusive
OR operator .............. 88
6.5.13 Logical
AND operator ................. 89
6.5.14 Logical
OR operator ................. 89
6.5.15 Conditional operator ................. 90
6.5.16 Assignment operators ................. 91
6.5.17 Comma operator ................... 94
6.6 Constant expressions ..................... 95
6.7 Declarations ........................ 97
6.7.1 Storage-class specifiers ................ 98
6.7.2 Type specifiers .................... 99
6.7.3 Type qualifiers ....................108
6.7.4 Function specifiers ..................112
6.7.5 Declarators .....................114
6.7.6 Type names .....................122
6.7.7 Type definitions ...................123
6.7.8 Initialization ....................125
6.8 Statements and blocks ....................131
6.8.1 Labeled statements ..................131
6.8.2 Compound statement .................132
6.8.3 Expression and null statements .............132
6.8.4 Selection statements .................133
6.8.5 Iteration statements ..................135
6.8.6 Jump statements ...................136
6.9 External definitions .....................140
6.9.1 Function definitions ..................141
6.9.2 External object definitions ...............143
6.10 Preprocessing directives ...................145
6.10.1 Conditional inclusion .................147
6.10.2 Source file inclusion .................149
6.10.3 Macro replacement ..................151
6.10.4 Line control .....................158
6.10.5 Error directive ....................159
6.10.6 Pragma directive ...................159
iv Contents
©ISO/IEC ISO/IEC 9899:1999 (E)
6.10.7 Null directive ....................160
6.10.8 Predefined macro names ................160
6.10.9 Pragma operator ...................161
6.11 Future language directions ..................163
6.11.1 Floating types ....................163
6.11.2 Linkages of identifiers .................163
6.11.3 External names ...................163
6.11.4 Character escape sequences ..............163
6.11.5 Storage-class specifiers ................163
6.11.6 Function declarators .................163
6.11.7 Function definitions ..................163
6.11.8 Pragma directives ..................163
6.11.9 Predefined macro names ................163
7. Library .............................164
7.1 Introduction ........................164
7.1.1 Definitions of terms ..................164
7.1.2 Standard headers ...................165
7.1.3 Reserved identifiers ..................166
7.1.4 Use of library functions ................166
7.2 Diagnostics <assert.h> ..................169
7.2.1 Program diagnostics .................169
7.3 Complex arithmetic <complex.h> ..............170
7.3.1 Introduction .....................170
7.3.2 Conventions .....................171
7.3.3 Branch cuts .....................171
7.3.4 The CX_LIMITED_RANGE pragma ...........171
7.3.5 Trigonometric functions ................172
7.3.6 Hyperbolic functions .................174
7.3.7 Exponential and logarithmic functions ..........176
7.3.8 Power and absolute-value functions ...........177
7.3.9 Manipulation functions ................178
7.4 Character handling <ctype.h> ................181
7.4.1 Character classification functions ............181
7.4.2 Character case mapping functions ............184
7.5 Errors <errno.h> .....................186
7.6 Floating-point environment <fenv.h> .............187
7.6.1 The FENV_ACCESS pragma ..............189
7.6.2 Floating-point exceptions ...............190
7.6.3 Rounding ......................192
7.6.4 Environment ....................194
7.7 Characteristics of floating types <float.h> ...........196
7.8 Format conversion of integer types <inttypes.h> ........197
7.8.1 Macros for format specifiers ..............197
7.8.2 Functions for greatest-width integer types .........198
Contents v