From Jason Turner

[intro]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpkyhb5tie/{from.md → to.md} +116 -69
tmp/tmpkyhb5tie/{from.md → to.md} RENAMED
@@ -13,35 +13,43 @@ Although this document states only requirements on C++ implementations,
13
  those requirements are often easier to understand if they are phrased as
14
  requirements on programs, parts of programs, or execution of programs.
15
  Such requirements have the following meaning:
16
 
17
  - If a program contains no violations of the rules in [[lex]] through
18
- [[thread]] and [[depr]], a conforming implementation shall, within its
19
- resource limits as described in [[implimits]], accept and correctly
20
- execute[^3] that program.
21
  - If a program contains a violation of a rule for which no diagnostic is
22
  required, this document places no requirement on implementations with
23
  respect to that program.
24
- - Otherwise, if a program contains a violation of any diagnosable rule
25
- or an occurrence of a construct described in this document as
 
 
 
26
  “conditionally-supported” when the implementation does not support
27
- that construct, a conforming implementation shall issue at least one
28
- diagnostic message.
 
 
 
 
 
29
 
30
  [*Note 1*: During template argument deduction and substitution, certain
31
  constructs that in other contexts require a diagnostic are treated
32
  differently; see  [[temp.deduct]]. — *end note*]
33
 
34
- Furthermore, a conforming implementation
35
 
36
- - shall not accept a preprocessing translation unit containing a
37
- `#error` preprocessing directive [[cpp.error]],
38
- - shall issue at least one diagnostic message for each `#warning` or
39
- `#error` preprocessing directive not following a `#error`
40
- preprocessing directive in a preprocessing translation unit, and
41
- - shall not accept a translation unit with a *static_assert-declaration*
42
- that fails [[dcl.pre]].
43
 
44
  For classes and class templates, the library Clauses specify partial
45
  definitions. Private members [[class.access]] are not specified, but
46
  each implementation shall supply them to complete the definitions
47
  according to the description in the library Clauses.
@@ -58,95 +66,132 @@ header or importing the appropriate standard library named header unit
58
  The templates, classes, functions, and objects in the library have
59
  external linkage [[basic.link]]. The implementation provides definitions
60
  for standard library entities, as necessary, while combining translation
61
  units to form a complete C++ program [[lex.phases]].
62
 
63
- Two kinds of implementations are defined: a *hosted implementation* and
64
- a *freestanding implementation*. A freestanding implementation is one in
65
  which execution may take place without the benefit of an operating
66
  system. A hosted implementation supports all the facilities described in
67
  this document, while a freestanding implementation supports the entire
68
- C++ language described in [[lex]] through [[cpp]] and the subset of the
69
- library facilities described in [[compliance]].
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
 
71
  A conforming implementation may have extensions (including additional
72
  library functions), provided they do not alter the behavior of any
73
  well-formed program. Implementations are required to diagnose programs
74
  that use such extensions that are ill-formed according to this document.
75
  Having done so, however, they can compile and execute such programs.
76
 
77
  Each implementation shall include documentation that identifies all
78
  conditionally-supported constructs that it does not support and defines
79
- all locale-specific characteristics.[^4]
80
 
81
  ### Abstract machine <a id="intro.abstract">[[intro.abstract]]</a>
82
 
83
  The semantic descriptions in this document define a parameterized
84
  nondeterministic abstract machine. This document places no requirement
85
  on the structure of conforming implementations. In particular, they need
86
  not copy or emulate the structure of the abstract machine. Rather,
87
  conforming implementations are required to emulate (only) the observable
88
- behavior of the abstract machine as explained below.[^5]
89
 
90
  Certain aspects and operations of the abstract machine are described in
91
- this document as implementation-defined (for example, `sizeof(int)`).
92
- These constitute the parameters of the abstract machine. Each
93
- implementation shall include documentation describing its
94
- characteristics and behavior in these respects.[^6]
95
 
96
  Such documentation shall define the instance of the abstract machine
97
  that corresponds to that implementation (referred to as the
98
  “corresponding instance” below).
99
 
100
  Certain other aspects and operations of the abstract machine are
101
- described in this document as unspecified (for example, order of
102
- evaluation of arguments in a function call [[expr.call]]). Where
103
  possible, this document defines a set of allowable behaviors. These
104
  define the nondeterministic aspects of the abstract machine. An instance
105
  of the abstract machine can thus have more than one possible execution
106
  for a given program and a given input.
107
 
108
  Certain other operations are described in this document as undefined
109
- (for example, the effect of attempting to modify a const object).
 
110
 
111
- [*Note 1*: This document imposes no requirements on the behavior of
112
- programs that contain undefined behavior. — *end note*]
 
 
 
 
 
 
 
 
 
 
 
113
 
114
  A conforming implementation executing a well-formed program shall
115
- produce the same observable behavior as one of the possible executions
116
- of the corresponding instance of the abstract machine with the same
117
- program and the same input. However, if any such execution contains an
118
- undefined operation, this document places no requirement on the
119
- implementation executing that program with that input (not even with
120
- regard to operations preceding the first undefined operation).
 
 
 
121
 
122
- The least requirements on a conforming implementation are:
 
 
 
 
 
 
 
 
123
 
124
  - Accesses through volatile glvalues are evaluated strictly according to
125
  the rules of the abstract machine.
126
- - At program termination, all data written into files shall be identical
127
- to one of the possible results that execution of the program according
128
- to the abstract semantics would have produced.
 
 
129
  - The input and output dynamics of interactive devices shall take place
130
  in such a fashion that prompting output is actually delivered before a
131
  program waits for input. What constitutes an interactive device is
132
  *implementation-defined*.
133
 
134
- These collectively are referred to as the *observable behavior* of the
135
- program.
136
-
137
- [*Note 2*: More stringent correspondences between abstract and actual
138
  semantics can be defined by each implementation. — *end note*]
139
 
140
  ## Structure of this document <a id="intro.structure">[[intro.structure]]</a>
141
 
142
- [[lex]] through [[cpp]] describe the C++ programming language. That
143
- description includes detailed syntactic specifications in a form
144
- described in  [[syntax]]. For convenience, [[gram]] repeats all such
145
- syntactic specifications.
146
 
147
- [[support]] through [[thread]] and [[depr]] (the *library clauses*)
148
  describe the C++ standard library. That description includes detailed
149
  descriptions of the entities and macros that constitute the library, in
150
  a form described in [[library]].
151
 
152
  [[implimits]] recommends lower bounds on the capacity of conforming
@@ -158,12 +203,12 @@ Certain features of C++ exist solely for compatibility purposes;
158
  [[depr]] describes those features.
159
 
160
  ## Syntax notation <a id="syntax">[[syntax]]</a>
161
 
162
  In the syntax notation used in this document, syntactic categories are
163
- indicated by *italic* type, and literal words and characters in
164
- `constant` `width` type. Alternatives are listed on separate lines
165
  except in a few cases where a long set of alternatives is marked by the
166
  phrase “one of”. If the text of an alternative is too long to fit on a
167
  line, the text is continued on subsequent lines indented from the first
168
  one. An optional terminal or non-terminal symbol is indicated by the
169
  subscript “\relaxₒₚₜ ”, so
@@ -180,35 +225,39 @@ the following rules:
180
  - *X-name* is a use of an identifier in a context that determines its
181
  meaning (e.g., *class-name*, *typedef-name*).
182
  - *X-id* is an identifier with no context-dependent meaning (e.g.,
183
  *qualified-id*).
184
  - *X-seq* is one or more *X*’s without intervening delimiters (e.g.,
185
- *declaration-seq* is a sequence of declarations).
186
  - *X-list* is one or more *X*’s separated by intervening commas (e.g.,
187
- *identifier-list* is a sequence of identifiers separated by commas).
188
 
189
  <!-- Link reference definitions -->
 
190
  [algorithm.stable]: library.md#algorithm.stable
 
 
191
  [basic.fundamental]: basic.md#basic.fundamental
192
  [basic.link]: basic.md#basic.link
 
193
  [class.access]: class.md#class.access
194
  [class.copy.assign]: class.md#class.copy.assign
195
  [class.ctor]: class.md#class.ctor
196
  [class.derived]: class.md#class.derived
197
  [compliance]: library.md#compliance
198
  [conv.lval]: expr.md#conv.lval
199
- [cpp]: cpp.md#cpp
200
  [cpp.error]: cpp.md#cpp.error
 
201
  [dcl.pre]: dcl.md#dcl.pre
202
  [dcl.ptr]: dcl.md#dcl.ptr
203
  [dcl.ref]: dcl.md#dcl.ref
204
- [defns.repositional.stream]: #defns.repositional.stream
205
  [defns.well.formed]: #defns.well.formed
206
  [depr]: future.md#depr
207
  [diff]: compatibility.md#diff
208
  [diff.library]: compatibility.md#diff.library
209
- [expr.ass]: expr.md#expr.ass
 
210
  [expr.call]: expr.md#expr.call
211
  [expr.const]: expr.md#expr.const
212
  [expr.post.incr]: expr.md#expr.post.incr
213
  [expr.pre.incr]: expr.md#expr.pre.incr
214
  [gram]: grammar.md#gram
@@ -218,48 +267,46 @@ the following rules:
218
  [intro.abstract]: #intro.abstract
219
  [intro.compliance]: #intro.compliance
220
  [intro.compliance.general]: #intro.compliance.general
221
  [intro.defs]: #intro.defs
222
  [intro.execution]: basic.md#intro.execution
 
223
  [intro.refs]: #intro.refs
224
  [intro.scope]: #intro.scope
225
  [intro.structure]: #intro.structure
226
  [lex]: lex.md#lex
227
  [lex.phases]: lex.md#lex.phases
228
  [library]: library.md#library
229
- [localization]: localization.md#localization
230
- [re]: re.md#re
231
  [strings]: strings.md#strings
 
232
  [support]: support.md#support
233
  [syntax]: #syntax
234
  [temp.deduct]: temp.md#temp.deduct
235
- [thread]: thread.md#thread
236
  [using.headers]: library.md#using.headers
 
237
 
238
  [^1]: POSIX is a registered trademark of the Institute of Electrical and
239
  Electronic Engineers, Inc. This information is given for the
240
  convenience of users of this document and does not constitute an
241
  endorsement by ISO or IEC of this product.
242
 
243
- [^2]: With the qualifications noted in [[support]] through [[thread]]
244
- and in [[diff.library]], the C standard library is a subset of the
245
- C++ standard library.
246
 
247
- [^3]: “Correct execution” can include undefined behavior, depending on
248
- the data being processed; see [[intro.defs]] and 
249
- [[intro.execution]].
250
-
251
- [^4]: This documentation also defines implementation-defined behavior;
252
  see  [[intro.abstract]].
253
 
254
- [^5]: This provision is sometimes called the “as-if” rule, because an
255
  implementation is free to disregard any requirement of this document
256
  as long as the result is *as if* the requirement had been obeyed, as
257
  far as can be determined from the observable behavior of the
258
  program. For instance, an actual implementation need not evaluate
259
  part of an expression if it can deduce that its value is not used
260
  and that no side effects affecting the observable behavior of the
261
  program are produced.
262
 
263
- [^6]: This documentation also includes conditionally-supported
264
  constructs and locale-specific behavior. See 
265
  [[intro.compliance.general]].
 
13
  those requirements are often easier to understand if they are phrased as
14
  requirements on programs, parts of programs, or execution of programs.
15
  Such requirements have the following meaning:
16
 
17
  - If a program contains no violations of the rules in [[lex]] through
18
+ [[exec]] as well as those specified in [[depr]], a conforming
19
+ implementation shall accept and correctly execute[^2] that program,
20
+ except when the implementation’s limitations (see below) are exceeded.
21
  - If a program contains a violation of a rule for which no diagnostic is
22
  required, this document places no requirement on implementations with
23
  respect to that program.
24
+ - Otherwise, if a program contains
25
+ - a violation of any diagnosable rule,
26
+ - a preprocessing translation unit with a `#warning` preprocessing
27
+ directive [[cpp.error]],
28
+ - an occurrence of a construct described in this document as
29
  “conditionally-supported” when the implementation does not support
30
+ that construct, or
31
+ - a contract assertion [[basic.contract.eval]] evaluated with a
32
+ checking semantic in a manifestly constant-evaluated context
33
+ [[expr.const]] resulting in a contract violation,
34
+
35
+ a conforming implementation shall issue at least one diagnostic
36
+ message.
37
 
38
  [*Note 1*: During template argument deduction and substitution, certain
39
  constructs that in other contexts require a diagnostic are treated
40
  differently; see  [[temp.deduct]]. — *end note*]
41
 
42
+ Furthermore, a conforming implementation shall not accept
43
 
44
+ - a preprocessing translation unit containing a `#error` preprocessing
45
+ directive [[cpp.error]],
46
+ - a translation unit with a *static_assert-declaration* that fails
47
+ [[dcl.pre]], or
48
+ - a contract assertion evaluated with a terminating semantic
49
+ [[basic.contract.eval]] in a manifestly constant-evaluated context
50
+ [[expr.const]] resulting in a contract violation.
51
 
52
  For classes and class templates, the library Clauses specify partial
53
  definitions. Private members [[class.access]] are not specified, but
54
  each implementation shall supply them to complete the definitions
55
  according to the description in the library Clauses.
 
66
  The templates, classes, functions, and objects in the library have
67
  external linkage [[basic.link]]. The implementation provides definitions
68
  for standard library entities, as necessary, while combining translation
69
  units to form a complete C++ program [[lex.phases]].
70
 
71
+ An implementation is either a *hosted implementation* or a
72
+ *freestanding implementation*. A freestanding implementation is one in
73
  which execution may take place without the benefit of an operating
74
  system. A hosted implementation supports all the facilities described in
75
  this document, while a freestanding implementation supports the entire
76
+ C++ language described in [[lex]] through [[\lastcorechapter]] and the
77
+ subset of the library facilities described in [[compliance]].
78
+
79
+ It is *implementation-defined* whether the implementation is a
80
+ *hardened implementation*. If it is a hardened implementation, violating
81
+ a hardened precondition results in a contract violation
82
+ [[structure.specifications]].
83
+
84
+ An implementation is encouraged to document its limitations in the size
85
+ or complexity of the programs it can successfully process, if possible
86
+ and where known. [[implimits]] lists some quantities that can be subject
87
+ to limitations and a potential minimum supported value for each
88
+ quantity.
89
+
90
+ A conforming implementation may use an implementation-defined version of
91
+ the Unicode Standard that is a later version than the one referenced in
92
+ [[intro.refs]].
93
 
94
  A conforming implementation may have extensions (including additional
95
  library functions), provided they do not alter the behavior of any
96
  well-formed program. Implementations are required to diagnose programs
97
  that use such extensions that are ill-formed according to this document.
98
  Having done so, however, they can compile and execute such programs.
99
 
100
  Each implementation shall include documentation that identifies all
101
  conditionally-supported constructs that it does not support and defines
102
+ all locale-specific characteristics.[^3]
103
 
104
  ### Abstract machine <a id="intro.abstract">[[intro.abstract]]</a>
105
 
106
  The semantic descriptions in this document define a parameterized
107
  nondeterministic abstract machine. This document places no requirement
108
  on the structure of conforming implementations. In particular, they need
109
  not copy or emulate the structure of the abstract machine. Rather,
110
  conforming implementations are required to emulate (only) the observable
111
+ behavior of the abstract machine as explained below.[^4]
112
 
113
  Certain aspects and operations of the abstract machine are described in
114
+ this document as implementation-defined behavior (for example,
115
+ `sizeof(int)`). These constitute the parameters of the abstract machine.
116
+ Each implementation shall include documentation describing its
117
+ characteristics and behavior in these respects.[^5]
118
 
119
  Such documentation shall define the instance of the abstract machine
120
  that corresponds to that implementation (referred to as the
121
  “corresponding instance” below).
122
 
123
  Certain other aspects and operations of the abstract machine are
124
+ described in this document as unspecified behavior (for example, order
125
+ of evaluation of arguments in a function call [[expr.call]]). Where
126
  possible, this document defines a set of allowable behaviors. These
127
  define the nondeterministic aspects of the abstract machine. An instance
128
  of the abstract machine can thus have more than one possible execution
129
  for a given program and a given input.
130
 
131
  Certain other operations are described in this document as undefined
132
+ behavior (for example, the effect of attempting to modify a const
133
+ object).
134
 
135
+ Certain events in the execution of a program are termed
136
+ *observable checkpoints*.
137
+
138
+ [*Note 1*: A call to `std::observable_checkpoint` [[utility.undefined]]
139
+ is an observable checkpoint, as are certain parts of the evaluation of
140
+ contract assertions [[basic.contract]]. — *end note*]
141
+
142
+ The *defined prefix* of an execution comprises the operations O for
143
+ which for every undefined operation U there is an observable checkpoint
144
+ C such that O happens before C and C happens before U.
145
+
146
+ [*Note 2*: The undefined behavior that arises from a data race
147
+ [[intro.races]] occurs on all participating threads. — *end note*]
148
 
149
  A conforming implementation executing a well-formed program shall
150
+ produce the observable behavior of the defined prefix of one of the
151
+ possible executions of the corresponding instance of the abstract
152
+ machine with the same program and the same input. If the selected
153
+ execution contains an undefined operation, the implementation executing
154
+ that program with that input may produce arbitrary additional observable
155
+ behavior afterwards. If the execution contains an operation specified as
156
+ having erroneous behavior, the implementation is permitted to issue a
157
+ diagnostic and is permitted to terminate the execution at an unspecified
158
+ time after that operation.
159
 
160
+ *Recommended practice:* An implementation should issue a diagnostic when
161
+ such an operation is executed.
162
+
163
+ [*Note 3*: An implementation can issue a diagnostic if it can determine
164
+ that erroneous behavior is reachable under an implementation-specific
165
+ set of assumptions about the program behavior, which can result in false
166
+ positives. — *end note*]
167
+
168
+ The following specify the *observable behavior* of the program:
169
 
170
  - Accesses through volatile glvalues are evaluated strictly according to
171
  the rules of the abstract machine.
172
+ - Data is delivered to the host environment to be written into files
173
+ (See also: ISO C 7.23.3). \[*Note 4*: Delivering such data is followed
174
+ by an observable checkpoint [[cstdio.syn]]. Not all host environments
175
+ provide access to file contents before program
176
+ termination. — *end note*]
177
  - The input and output dynamics of interactive devices shall take place
178
  in such a fashion that prompting output is actually delivered before a
179
  program waits for input. What constitutes an interactive device is
180
  *implementation-defined*.
181
 
182
+ [*Note 5*: More stringent correspondences between abstract and actual
 
 
 
183
  semantics can be defined by each implementation. — *end note*]
184
 
185
  ## Structure of this document <a id="intro.structure">[[intro.structure]]</a>
186
 
187
+ [[lex]] through [[\lastcorechapter]] describe the C++ programming
188
+ language. That description includes detailed syntactic specifications in
189
+ a form described in  [[syntax]]. For convenience, [[gram]] repeats all
190
+ such syntactic specifications.
191
 
192
+ [[support]] through [[exec]] and [[depr]] (the *library clauses*)
193
  describe the C++ standard library. That description includes detailed
194
  descriptions of the entities and macros that constitute the library, in
195
  a form described in [[library]].
196
 
197
  [[implimits]] recommends lower bounds on the capacity of conforming
 
203
  [[depr]] describes those features.
204
 
205
  ## Syntax notation <a id="syntax">[[syntax]]</a>
206
 
207
  In the syntax notation used in this document, syntactic categories are
208
+ indicated by *italic, sans-serif* type, and literal words and characters
209
+ in `constant` `width` type. Alternatives are listed on separate lines
210
  except in a few cases where a long set of alternatives is marked by the
211
  phrase “one of”. If the text of an alternative is too long to fit on a
212
  line, the text is continued on subsequent lines indented from the first
213
  one. An optional terminal or non-terminal symbol is indicated by the
214
  subscript “\relaxₒₚₜ ”, so
 
225
  - *X-name* is a use of an identifier in a context that determines its
226
  meaning (e.g., *class-name*, *typedef-name*).
227
  - *X-id* is an identifier with no context-dependent meaning (e.g.,
228
  *qualified-id*).
229
  - *X-seq* is one or more *X*’s without intervening delimiters (e.g.,
230
+ *declaration-seq* is a sequence of *declaration*s).
231
  - *X-list* is one or more *X*’s separated by intervening commas (e.g.,
232
+ *identifier-list* is a sequence of *identifier*s separated by commas).
233
 
234
  <!-- Link reference definitions -->
235
+ [\lastcorechapter]: #\lastcorechapter
236
  [algorithm.stable]: library.md#algorithm.stable
237
+ [basic.contract]: basic.md#basic.contract
238
+ [basic.contract.eval]: basic.md#basic.contract.eval
239
  [basic.fundamental]: basic.md#basic.fundamental
240
  [basic.link]: basic.md#basic.link
241
+ [basic.types.general]: basic.md#basic.types.general
242
  [class.access]: class.md#class.access
243
  [class.copy.assign]: class.md#class.copy.assign
244
  [class.ctor]: class.md#class.ctor
245
  [class.derived]: class.md#class.derived
246
  [compliance]: library.md#compliance
247
  [conv.lval]: expr.md#conv.lval
 
248
  [cpp.error]: cpp.md#cpp.error
249
+ [cstdio.syn]: input.md#cstdio.syn
250
  [dcl.pre]: dcl.md#dcl.pre
251
  [dcl.ptr]: dcl.md#dcl.ptr
252
  [dcl.ref]: dcl.md#dcl.ref
 
253
  [defns.well.formed]: #defns.well.formed
254
  [depr]: future.md#depr
255
  [diff]: compatibility.md#diff
256
  [diff.library]: compatibility.md#diff.library
257
+ [exec]: exec.md#exec
258
+ [expr.assign]: expr.md#expr.assign
259
  [expr.call]: expr.md#expr.call
260
  [expr.const]: expr.md#expr.const
261
  [expr.post.incr]: expr.md#expr.post.incr
262
  [expr.pre.incr]: expr.md#expr.pre.incr
263
  [gram]: grammar.md#gram
 
267
  [intro.abstract]: #intro.abstract
268
  [intro.compliance]: #intro.compliance
269
  [intro.compliance.general]: #intro.compliance.general
270
  [intro.defs]: #intro.defs
271
  [intro.execution]: basic.md#intro.execution
272
+ [intro.races]: basic.md#intro.races
273
  [intro.refs]: #intro.refs
274
  [intro.scope]: #intro.scope
275
  [intro.structure]: #intro.structure
276
  [lex]: lex.md#lex
277
  [lex.phases]: lex.md#lex.phases
278
  [library]: library.md#library
279
+ [localization]: text.md#localization
280
+ [re]: text.md#re
281
  [strings]: strings.md#strings
282
+ [structure.specifications]: library.md#structure.specifications
283
  [support]: support.md#support
284
  [syntax]: #syntax
285
  [temp.deduct]: temp.md#temp.deduct
 
286
  [using.headers]: library.md#using.headers
287
+ [utility.undefined]: utilities.md#utility.undefined
288
 
289
  [^1]: POSIX is a registered trademark of the Institute of Electrical and
290
  Electronic Engineers, Inc. This information is given for the
291
  convenience of users of this document and does not constitute an
292
  endorsement by ISO or IEC of this product.
293
 
294
+ [^2]: “Correct execution” can include undefined behavior and erroneous
295
+ behavior, depending on the data being processed; see [[intro.defs]]
296
+ and  [[intro.execution]].
297
 
298
+ [^3]: This documentation also defines implementation-defined behavior;
 
 
 
 
299
  see  [[intro.abstract]].
300
 
301
+ [^4]: This provision is sometimes called the “as-if” rule, because an
302
  implementation is free to disregard any requirement of this document
303
  as long as the result is *as if* the requirement had been obeyed, as
304
  far as can be determined from the observable behavior of the
305
  program. For instance, an actual implementation need not evaluate
306
  part of an expression if it can deduce that its value is not used
307
  and that no side effects affecting the observable behavior of the
308
  program are produced.
309
 
310
+ [^5]: This documentation also includes conditionally-supported
311
  constructs and locale-specific behavior. See 
312
  [[intro.compliance.general]].