没有合适的资源?快使用搜索试试~ 我知道了~
首页ISO/IEC 9899:2017 ,现行的C标准2017.pdf
ISO/IEC 9899:2017 ,现行的C标准2017.pdf

ISO/IEC 9899:2017 ,现行的C标准2017,英文版,文字版,带书签
资源详情
资源评论
资源推荐

N2176 C17 ballot ISO/IEC 9899:2017
INTERNATIONAL STANDARD ©ISO/IEC ISO/IEC9899:2017
Programming languages — C
(cover sheet to be replaced by ISO)
This is a working document of SC22/WG14
This version of the document is intended to be the version that is to go into ballot for C17.
—
It is based on the transformed L
A
T
E
Xversion of the document that has been proofread by the
members of WG14 and that has been approved by teleconference in June 2017.
— It applies all TCs of closed DRs up to April 2017.
— It applies the changes that have been voted in Markham.
— It updates some normative references.
— It provides the minimal changes required for a new version of the standard.
— It integrates some editorial changes that had been found during the revision process.
A brief explanation of the changes could still be added to the foreword.
Document conventions
This document classifies identifiers into different categories. This categorization is important to
produce a correct index.
The classes are
— Normal identifiers, toto.
— keywords, while
— symbols with external linkage of the C library, malloc
— types, size
_
t
— predefined macros that alias language features, complex
— other predefined macros, EOF
— pragmas and their particles, STDC
— tag names and members of struct, union or enum, tv
_
sec
— name fragments, usually reserved prefixes, atomic
_
I

ISO/IEC 9899:2017 C17 ballot N2176
—
character literals,
’a’
or
’ ’
, and wide character literals,
L’Ä’
, string literals of
char
type,
"string"
and
u8"ströng"
, and string literals of wide character type,
L"ströng"
, character
sequences
thompson\0
,
%zu
or wide character sequences
hello
. Space in these are visible
spaces “ ” such as in "a b c d".
— abstract values are written as mathematical expressions, such as 0, x, 65535 or 2
n
− 1.
The classification is not always unique, we have identifiers that can refer to a library function in
math.h or to a type generic macro in tgmath.h. Currently we give preference to the fact of being a
library function, e.g we have sqrt.
II

N2176 C17 ballot ISO/IEC 9899:2017
Abstract
(Cover sheet to be provided by ISO Secretariat.)
This International Standard specifies the form and establishes the interpretation of programs
expressed in the programming language C. Its purpose is to promote portability, reliability, main-
tainability, and efficient execution of C language programs on a variety of computing systems.
Clauses are included that detail the C language itself and the contents of the C language
execution library. Annexes summarize aspects of both of them, and enumerate factors that
influence the portability of C programs.
Although this International Standard is intended to guide knowledgeable C language pro-
grammers as well as implementors of C language translation systems, the document itself is not
designed to serve as a tutorial.
Recipients of this draft are invited to submit, with their comments, notification of any relevant
patent rights of which they are aware and to provide supporting documentation.
Abstract i

ISO/IEC 9899:2017 C17 ballot N2176
Contents
Foreword xiv
Introduction xvii
1 Scope 1
2 Normative references 2
3 Terms, definitions, and symbols 3
4 Conformance 8
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 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
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
ii Contents

N2176 C17 ballot ISO/IEC 9899:2017
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
Contents iii
剩余533页未读,继续阅读













安全验证
文档复制为VIP权益,开通VIP直接复制

评论3