From Jason Turner

[intro]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpeqp9j5hd/{from.md → to.md} +139 -1139
tmp/tmpeqp9j5hd/{from.md → to.md} RENAMED
@@ -1,378 +1,111 @@
1
  # General principles <a id="intro">[[intro]]</a>
2
 
3
  ## Implementation compliance <a id="intro.compliance">[[intro.compliance]]</a>
4
 
5
  The set of *diagnosable rules* consists of all syntactic and semantic
6
- rules in this International Standard except for those rules containing
7
- an explicit notation that “no diagnostic is required” or which are
8
- described as resulting in “undefined behavior”.
9
 
10
- Although this International Standard states only requirements on C++
11
- implementations, those requirements are often easier to understand if
12
- they are phrased as requirements on programs, parts of programs, or
13
- execution of programs. Such requirements have the following meaning:
14
 
15
- - If a program contains no violations of the rules in this International
16
- Standard, a conforming implementation shall, within its resource
17
- limits, accept and correctly execute[^2] that program.
18
  - If a program contains a violation of any diagnosable rule or an
19
- occurrence of a construct described in this International Standard as
20
  “conditionally-supported” when the implementation does not support
21
  that construct, a conforming implementation shall issue at least one
22
  diagnostic message.
23
  - If a program contains a violation of a rule for which no diagnostic is
24
- required, this International Standard places no requirement on
25
- implementations with respect to that program.
26
 
27
  [*Note 1*: During template argument deduction and substitution, certain
28
  constructs that in other contexts require a diagnostic are treated
29
  differently; see  [[temp.deduct]]. — *end note*]
30
 
31
  For classes and class templates, the library Clauses specify partial
32
- definitions. Private members (Clause  [[class.access]]) are not
33
- specified, but each implementation shall supply them to complete the
34
- definitions according to the description in the library Clauses.
35
 
36
  For functions, function templates, objects, and values, the library
37
  Clauses specify declarations. Implementations shall supply definitions
38
  consistent with the descriptions in the library Clauses.
39
 
40
- The names defined in the library have namespace scope (
41
- [[basic.namespace]]). A C++translation unit ([[lex.phases]]) obtains
42
  access to these names by including the appropriate standard library
43
- header ([[cpp.include]]).
 
44
 
45
  The templates, classes, functions, and objects in the library have
46
- external linkage ([[basic.link]]). The implementation provides
47
- definitions for standard library entities, as necessary, while combining
48
- translation units to form a complete C++program ([[lex.phases]]).
49
 
50
  Two kinds of implementations are defined: a *hosted implementation* and
51
  a *freestanding implementation*. For a hosted implementation, this
52
- International Standard defines the set of available libraries. A
53
- freestanding implementation is one in which execution may take place
54
- without the benefit of an operating system, and has an
55
- *implementation-defined* set of libraries that includes certain
56
- language-support libraries ([[compliance]]).
57
 
58
  A conforming implementation may have extensions (including additional
59
  library functions), provided they do not alter the behavior of any
60
  well-formed program. Implementations are required to diagnose programs
61
- that use such extensions that are ill-formed according to this
62
- International Standard. Having done so, however, they can compile and
63
- execute such programs.
64
 
65
  Each implementation shall include documentation that identifies all
66
  conditionally-supported constructs that it does not support and defines
67
  all locale-specific characteristics.[^3]
68
 
69
- ## Structure of this document <a id="intro.structure">[[intro.structure]]</a>
70
-
71
- Clauses  [[lex]] through  [[cpp]] describe the C++programming language.
72
- That description includes detailed syntactic specifications in a form
73
- described in  [[syntax]]. For convenience, Annex  [[gram]] repeats all
74
- such syntactic specifications.
75
-
76
- Clauses  [[language.support]] through  [[thread]] and Annex  [[depr]]
77
- (the *library clauses*) describe the C++standard library. That
78
- description includes detailed descriptions of the entities and macros
79
- that constitute the library, in a form described in Clause  [[library]].
80
-
81
- Annex  [[implimits]] recommends lower bounds on the capacity of
82
- conforming implementations.
83
-
84
- Annex  [[diff]] summarizes the evolution of C++since its first published
85
- description, and explains in detail the differences between C++and C.
86
- Certain features of C++exist solely for compatibility purposes; Annex 
87
- [[depr]] describes those features.
88
-
89
- Throughout this document, each example is introduced by “” and
90
- terminated by “”. Each note is introduced by “” and terminated by “”.
91
- Examples and notes may be nested.
92
-
93
- ## Syntax notation <a id="syntax">[[syntax]]</a>
94
-
95
- In the syntax notation used in this document, syntactic categories are
96
- indicated by *italic* type, and literal words and characters in
97
- `constant` `width` type. Alternatives are listed on separate lines
98
- except in a few cases where a long set of alternatives is marked by the
99
- phrase “one of”. If the text of an alternative is too long to fit on a
100
- line, the text is continued on subsequent lines indented from the first
101
- one. An optional terminal or non-terminal symbol is indicated by the
102
- subscript “”, so
103
-
104
- ``` bnf
105
- '{' expressionₒₚₜ '}'
106
- ```
107
-
108
- indicates an optional expression enclosed in braces.
109
-
110
- Names for syntactic categories have generally been chosen according to
111
- the following rules:
112
-
113
- - *X-name* is a use of an identifier in a context that determines its
114
- meaning (e.g., *class-name*, *typedef-name*).
115
- - *X-id* is an identifier with no context-dependent meaning (e.g.,
116
- *qualified-id*).
117
- - *X-seq* is one or more *X*’s without intervening delimiters (e.g.,
118
- *declaration-seq* is a sequence of declarations).
119
- - *X-list* is one or more *X*’s separated by intervening commas (e.g.,
120
- *identifier-list* is a sequence of identifiers separated by commas).
121
-
122
- ## The C++memory model <a id="intro.memory">[[intro.memory]]</a>
123
-
124
- The fundamental storage unit in the C++memory model is the *byte*. A
125
- byte is at least large enough to contain any member of the basic
126
- execution character set ([[lex.charset]]) and the eight-bit code units
127
- of the Unicode UTF-8 encoding form and is composed of a contiguous
128
- sequence of bits,[^4] the number of which is *implementation-defined*.
129
- The least significant bit is called the *low-order bit*; the most
130
- significant bit is called the *high-order bit*. The memory available to
131
- a C++program consists of one or more sequences of contiguous bytes.
132
- Every byte has a unique address.
133
-
134
- [*Note 1*: The representation of types is described in 
135
- [[basic.types]]. — *end note*]
136
-
137
- A *memory location* is either an object of scalar type or a maximal
138
- sequence of adjacent bit-fields all having nonzero width.
139
-
140
- [*Note 2*: Various features of the language, such as references and
141
- virtual functions, might involve additional memory locations that are
142
- not accessible to programs but are managed by the
143
- implementation. — *end note*]
144
-
145
- Two or more threads of execution ([[intro.multithread]]) can access
146
- separate memory locations without interfering with each other.
147
-
148
- [*Note 3*: Thus a bit-field and an adjacent non-bit-field are in
149
- separate memory locations, and therefore can be concurrently updated by
150
- two threads of execution without interference. The same applies to two
151
- bit-fields, if one is declared inside a nested struct declaration and
152
- the other is not, or if the two are separated by a zero-length bit-field
153
- declaration, or if they are separated by a non-bit-field declaration. It
154
- is not safe to concurrently update two bit-fields in the same struct if
155
- all fields between them are also bit-fields of nonzero
156
- width. — *end note*]
157
-
158
- [*Example 1*:
159
-
160
- A structure declared as
161
-
162
- ``` cpp
163
- struct {
164
- char a;
165
- int b:5,
166
- c:11,
167
- :0,
168
- d:8;
169
- struct {int ee:8;} e;
170
- }
171
- ```
172
-
173
- contains four separate memory locations: The field `a` and bit-fields
174
- `d` and `e.ee` are each separate memory locations, and can be modified
175
- concurrently without interfering with each other. The bit-fields `b` and
176
- `c` together constitute the fourth memory location. The bit-fields `b`
177
- and `c` cannot be concurrently modified, but `b` and `a`, for example,
178
- can be.
179
-
180
- — *end example*]
181
-
182
- ## The C++object model <a id="intro.object">[[intro.object]]</a>
183
-
184
- The constructs in a C++program create, destroy, refer to, access, and
185
- manipulate objects. An *object* is created by a definition (
186
- [[basic.def]]), by a *new-expression* ([[expr.new]]), when implicitly
187
- changing the active member of a union ([[class.union]]), or when a
188
- temporary object is created ([[conv.rval]], [[class.temporary]]). An
189
- object occupies a region of storage in its period of construction (
190
- [[class.cdtor]]), throughout its lifetime ([[basic.life]]), and in its
191
- period of destruction ([[class.cdtor]]).
192
-
193
- [*Note 1*: A function is not an object, regardless of whether or not it
194
- occupies storage in the way that objects do. — *end note*]
195
-
196
- The properties of an object are determined when the object is created.
197
- An object can have a name (Clause  [[basic]]). An object has a storage
198
- duration ([[basic.stc]]) which influences its lifetime (
199
- [[basic.life]]). An object has a type ([[basic.types]]). Some objects
200
- are polymorphic ([[class.virtual]]); the implementation generates
201
- information associated with each such object that makes it possible to
202
- determine that object’s type during program execution. For other
203
- objects, the interpretation of the values found therein is determined by
204
- the type of the *expression*s (Clause  [[expr]]) used to access them.
205
-
206
- Objects can contain other objects, called *subobjects*. A subobject can
207
- be a *member subobject* ([[class.mem]]), a *base class subobject*
208
- (Clause  [[class.derived]]), or an array element. An object that is not
209
- a subobject of any other object is called a *complete object*. If an
210
- object is created in storage associated with a member subobject or array
211
- element *e* (which may or may not be within its lifetime), the created
212
- object is a subobject of *e*’s containing object if:
213
-
214
- - the lifetime of *e*’s containing object has begun and not ended, and
215
- - the storage for the new object exactly overlays the storage location
216
- associated with *e*, and
217
- - the new object is of the same type as *e* (ignoring cv-qualification).
218
-
219
- [*Note 2*: If the subobject contains a reference member or a `const`
220
- subobject, the name of the original subobject cannot be used to access
221
- the new object ([[basic.life]]). — *end note*]
222
-
223
- [*Example 1*:
224
-
225
- ``` cpp
226
- struct X { const int n; };
227
- union U { X x; float f; };
228
- void tong() {
229
- U u = {{ 1 }};
230
- u.f = 5.f; // OK, creates new subobject of u ([class.union])
231
- X *p = new (&u.x) X {2}; // OK, creates new subobject of u
232
- assert(p->n == 2); // OK
233
- assert(*std::launder(&u.x.n) == 2); // OK
234
- assert(u.x.n == 2); // undefined behavior, u.x does not name new subobject
235
- }
236
- ```
237
-
238
- — *end example*]
239
-
240
- If a complete object is created ([[expr.new]]) in storage associated
241
- with another object *e* of type “array of N `unsigned char`” or of type
242
- “array of N `std::byte`” ([[cstddef.syn]]), that array *provides
243
- storage* for the created object if:
244
-
245
- - the lifetime of *e* has begun and not ended, and
246
- - the storage for the new object fits entirely within *e*, and
247
- - there is no smaller array object that satisfies these constraints.
248
-
249
- [*Note 3*: If that portion of the array previously provided storage for
250
- another object, the lifetime of that object ends because its storage was
251
- reused ([[basic.life]]). — *end note*]
252
-
253
- [*Example 2*:
254
-
255
- ``` cpp
256
- template<typename ...T>
257
- struct AlignedUnion {
258
- alignas(T...) unsigned char data[max(sizeof(T)...)];
259
- };
260
- int f() {
261
- AlignedUnion<int, char> au;
262
- int *p = new (au.data) int; // OK, au.data provides storage
263
- char *c = new (au.data) char(); // OK, ends lifetime of *p
264
- char *d = new (au.data + 1) char();
265
- return *c + *d; // OK
266
- }
267
-
268
- struct A { unsigned char a[32]; };
269
- struct B { unsigned char b[16]; };
270
- A a;
271
- B *b = new (a.a + 8) B; // a.a provides storage for *b
272
- int *p = new (b->b + 4) int; // b->b provides storage for *p
273
- // a.a does not provide storage for *p (directly),
274
- // but *p is nested within a (see below)
275
- ```
276
-
277
- — *end example*]
278
-
279
- An object *a* is *nested within* another object *b* if:
280
-
281
- - *a* is a subobject of *b*, or
282
- - *b* provides storage for *a*, or
283
- - there exists an object *c* where *a* is nested within *c*, and *c* is
284
- nested within *b*.
285
-
286
- For every object `x`, there is some object called the *complete object
287
- of* `x`, determined as follows:
288
-
289
- - If `x` is a complete object, then the complete object of `x` is
290
- itself.
291
- - Otherwise, the complete object of `x` is the complete object of the
292
- (unique) object that contains `x`.
293
-
294
- If a complete object, a data member ([[class.mem]]), or an array
295
- element is of class type, its type is considered the *most derived
296
- class*, to distinguish it from the class type of any base class
297
- subobject; an object of a most derived class type or of a non-class type
298
- is called a *most derived object*.
299
-
300
- Unless it is a bit-field ([[class.bit]]), a most derived object shall
301
- have a nonzero size and shall occupy one or more bytes of storage. Base
302
- class subobjects may have zero size. An object of trivially copyable or
303
- standard-layout type ([[basic.types]]) shall occupy contiguous bytes of
304
- storage.
305
-
306
- Unless an object is a bit-field or a base class subobject of zero size,
307
- the address of that object is the address of the first byte it occupies.
308
- Two objects *a* and *b* with overlapping lifetimes that are not
309
- bit-fields may have the same address if one is nested within the other,
310
- or if at least one is a base class subobject of zero size and they are
311
- of different types; otherwise, they have distinct addresses.[^5]
312
-
313
- [*Example 3*:
314
-
315
- ``` cpp
316
- static const char test1 = 'x';
317
- static const char test2 = 'x';
318
- const bool b = &test1 != &test2; // always true
319
- ```
320
-
321
- — *end example*]
322
-
323
- [*Note 4*: C++provides a variety of fundamental types and several ways
324
- of composing new types from existing types (
325
- [[basic.types]]). — *end note*]
326
-
327
- ## Program execution <a id="intro.execution">[[intro.execution]]</a>
328
-
329
- The semantic descriptions in this International Standard define a
330
- parameterized nondeterministic abstract machine. This International
331
- Standard places no requirement on the structure of conforming
332
- implementations. In particular, they need not copy or emulate the
333
- structure of the abstract machine. Rather, conforming implementations
334
- are required to emulate (only) the observable behavior of the abstract
335
- machine as explained below.[^6]
336
 
337
  Certain aspects and operations of the abstract machine are described in
338
- this International Standard as implementation-defined (for example,
339
- `sizeof(int)`). These constitute the parameters of the abstract machine.
340
- Each implementation shall include documentation describing its
341
- characteristics and behavior in these respects.[^7] Such documentation
342
  shall define the instance of the abstract machine that corresponds to
343
  that implementation (referred to as the “corresponding instance” below).
344
 
345
  Certain other aspects and operations of the abstract machine are
346
- described in this International Standard as unspecified (for example,
347
- evaluation of expressions in a *new-initializer* if the allocation
348
- function fails to allocate memory ([[expr.new]])). Where possible, this
349
- International Standard defines a set of allowable behaviors. These
350
  define the nondeterministic aspects of the abstract machine. An instance
351
  of the abstract machine can thus have more than one possible execution
352
  for a given program and a given input.
353
 
354
- Certain other operations are described in this International Standard as
355
- undefined (for example, the effect of attempting to modify a `const`
356
- object).
357
 
358
- [*Note 1*: This International Standard imposes no requirements on the
359
- behavior of programs that contain undefined behavior. — *end note*]
360
 
361
  A conforming implementation executing a well-formed program shall
362
  produce the same observable behavior as one of the possible executions
363
  of the corresponding instance of the abstract machine with the same
364
  program and the same input. However, if any such execution contains an
365
- undefined operation, this International Standard places no requirement
366
- on the implementation executing that program with that input (not even
367
- with regard to operations preceding the first undefined operation).
368
-
369
- An instance of each object with automatic storage duration (
370
- [[basic.stc.auto]]) is associated with each entry into its block. Such
371
- an object exists and retains its last-stored value during the execution
372
- of the block and while the block is suspended (by a call of a function
373
- or receipt of a signal).
374
 
375
  The least requirements on a conforming implementation are:
376
 
377
  - Accesses through volatile glvalues are evaluated strictly according to
378
  the rules of the abstract machine.
@@ -388,755 +121,71 @@ These collectively are referred to as the *observable behavior* of the
388
  program.
389
 
390
  [*Note 2*: More stringent correspondences between abstract and actual
391
  semantics may be defined by each implementation. — *end note*]
392
 
393
- [*Note 3*:
394
-
395
- Operators can be regrouped according to the usual mathematical rules
396
- only where the operators really are associative or commutative.[^8] For
397
- example, in the following fragment
398
-
399
- ``` cpp
400
- int a, b;
401
- ...
402
- a = a + 32760 + b + 5;
403
- ```
404
-
405
- the expression statement behaves exactly the same as
406
-
407
- ``` cpp
408
- a = (((a + 32760) + b) + 5);
409
- ```
410
-
411
- due to the associativity and precedence of these operators. Thus, the
412
- result of the sum `(a + 32760)` is next added to `b`, and that result is
413
- then added to 5 which results in the value assigned to `a`. On a machine
414
- in which overflows produce an exception and in which the range of values
415
- representable by an `int` is \[`-32768`, `+32767`\], the implementation
416
- cannot rewrite this expression as
417
-
418
- ``` cpp
419
- a = ((a + b) + 32765);
420
- ```
421
-
422
- since if the values for `a` and `b` were, respectively, -32754 and -15,
423
- the sum `a + b` would produce an exception while the original expression
424
- would not; nor can the expression be rewritten either as
425
-
426
- ``` cpp
427
- a = ((a + 32765) + b);
428
- ```
429
-
430
- or
431
-
432
- ``` cpp
433
- a = (a + (b + 32765));
434
- ```
435
-
436
- since the values for `a` and `b` might have been, respectively, 4 and -8
437
- or -17 and 12. However on a machine in which overflows do not produce an
438
- exception and in which the results of overflows are reversible, the
439
- above expression statement can be rewritten by the implementation in any
440
- of the above ways because the same result will occur.
441
-
442
- *end note*]
443
-
444
- A *constituent expression* is defined as follows:
445
-
446
- - The constituent expression of an expression is that expression.
447
- - The constituent expressions of a *braced-init-list* or of a (possibly
448
- parenthesized) *expression-list* are the constituent expressions of
449
- the elements of the respective list.
450
- - The constituent expressions of a *brace-or-equal-initializer* of the
451
- form `=` *initializer-clause* are the constituent expressions of the
452
- *initializer-clause*.
453
-
454
- [*Example 1*:
455
-
456
- ``` cpp
457
- struct A { int x; };
458
- struct B { int y; struct A a; };
459
- B b = { 5, { 1+1 } };
460
- ```
461
-
462
- The constituent expressions of the *initializer* used for the
463
- initialization of `b` are `5` and `1+1`.
464
-
465
- — *end example*]
466
-
467
- The *immediate subexpressions* of an expression `e` are
468
-
469
- - the constituent expressions of `e`’s operands (Clause [[expr]]),
470
- - any function call that `e` implicitly invokes,
471
- - if `e` is a *lambda-expression* ([[expr.prim.lambda]]), the
472
- initialization of the entities captured by copy and the constituent
473
- expressions of the *initializer* of the *init-capture*s,
474
- - if `e` is a function call ([[expr.call]]) or implicitly invokes a
475
- function, the constituent expressions of each default argument (
476
- [[dcl.fct.default]]) used in the call, or
477
- - if `e` creates an aggregate object ([[dcl.init.aggr]]), the
478
- constituent expressions of each default member initializer (
479
- [[class.mem]]) used in the initialization.
480
-
481
- A *subexpression* of an expression `e` is an immediate subexpression of
482
- `e` or a subexpression of an immediate subexpression of `e`.
483
-
484
- [*Note 4*: Expressions appearing in the *compound-statement* of a
485
- *lambda-expression* are not subexpressions of the
486
- *lambda-expression*. — *end note*]
487
-
488
- A *full-expression* is
489
-
490
- - an unevaluated operand (Clause [[expr]]),
491
- - a *constant-expression* ([[expr.const]]),
492
- - an *init-declarator* (Clause [[dcl.decl]]) or a *mem-initializer* (
493
- [[class.base.init]]), including the constituent expressions of the
494
- initializer,
495
- - an invocation of a destructor generated at the end of the lifetime of
496
- an object other than a temporary object ([[class.temporary]]), or
497
- - an expression that is not a subexpression of another expression and
498
- that is not otherwise part of a full-expression.
499
-
500
- If a language construct is defined to produce an implicit call of a
501
- function, a use of the language construct is considered to be an
502
- expression for the purposes of this definition. Conversions applied to
503
- the result of an expression in order to satisfy the requirements of the
504
- language construct in which the expression appears are also considered
505
- to be part of the full-expression. For an initializer, performing the
506
- initialization of the entity (including evaluating default member
507
- initializers of an aggregate) is also considered part of the
508
- full-expression.
509
-
510
- [*Example 2*:
511
-
512
- ``` cpp
513
- struct S {
514
- S(int i): I(i) { } // full-expression is initialization of I
515
- int& v() { return I; }
516
- ~S() noexcept(false) { }
517
- private:
518
- int I;
519
- };
520
-
521
- S s1(1); // full-expression is call of S::S(int)
522
- void f() {
523
- S s2 = 2; // full-expression is call of S::S(int)
524
- if (S(3).v()) // full-expression includes lvalue-to-rvalue and
525
- // int to bool conversions, performed before
526
- // temporary is deleted at end of full-expression
527
- { }
528
- bool b = noexcept(S()); // exception specification of destructor of S
529
- // considered for noexcept
530
- // full-expression is destruction of s2 at end of block
531
- }
532
- struct B {
533
- B(S = S(0));
534
- };
535
- B b[2] = { B(), B() }; // full-expression is the entire initialization
536
- // including the destruction of temporaries
537
- ```
538
-
539
- — *end example*]
540
-
541
- [*Note 5*: The evaluation of a full-expression can include the
542
- evaluation of subexpressions that are not lexically part of the
543
- full-expression. For example, subexpressions involved in evaluating
544
- default arguments ([[dcl.fct.default]]) are considered to be created in
545
- the expression that calls the function, not the expression that defines
546
- the default argument. — *end note*]
547
-
548
- Reading an object designated by a `volatile` glvalue ([[basic.lval]]),
549
- modifying an object, calling a library I/O function, or calling a
550
- function that does any of those operations are all *side effects*, which
551
- are changes in the state of the execution environment. *Evaluation* of
552
- an expression (or a subexpression) in general includes both value
553
- computations (including determining the identity of an object for
554
- glvalue evaluation and fetching a value previously assigned to an object
555
- for prvalue evaluation) and initiation of side effects. When a call to a
556
- library I/O function returns or an access through a volatile glvalue is
557
- evaluated the side effect is considered complete, even though some
558
- external actions implied by the call (such as the I/O itself) or by the
559
- `volatile` access may not have completed yet.
560
-
561
- *Sequenced before* is an asymmetric, transitive, pair-wise relation
562
- between evaluations executed by a single thread (
563
- [[intro.multithread]]), which induces a partial order among those
564
- evaluations. Given any two evaluations *A* and *B*, if *A* is sequenced
565
- before *B* (or, equivalently, *B* is *sequenced after* *A*), then the
566
- execution of *A* shall precede the execution of *B*. If *A* is not
567
- sequenced before *B* and *B* is not sequenced before *A*, then *A* and
568
- *B* are *unsequenced*.
569
-
570
- [*Note 6*: The execution of unsequenced evaluations can
571
- overlap. — *end note*]
572
-
573
- Evaluations *A* and *B* are *indeterminately sequenced* when either *A*
574
- is sequenced before *B* or *B* is sequenced before *A*, but it is
575
- unspecified which.
576
-
577
- [*Note 7*: Indeterminately sequenced evaluations cannot overlap, but
578
- either could be executed first. — *end note*]
579
-
580
- An expression *X* is said to be sequenced before an expression *Y* if
581
- every value computation and every side effect associated with the
582
- expression *X* is sequenced before every value computation and every
583
- side effect associated with the expression *Y*.
584
-
585
- Every value computation and side effect associated with a
586
- full-expression is sequenced before every value computation and side
587
- effect associated with the next full-expression to be evaluated.[^9]
588
-
589
- Except where noted, evaluations of operands of individual operators and
590
- of subexpressions of individual expressions are unsequenced.
591
-
592
- [*Note 8*: In an expression that is evaluated more than once during the
593
- execution of a program, unsequenced and indeterminately sequenced
594
- evaluations of its subexpressions need not be performed consistently in
595
- different evaluations. — *end note*]
596
-
597
- The value computations of the operands of an operator are sequenced
598
- before the value computation of the result of the operator. If a side
599
- effect on a memory location ([[intro.memory]]) is unsequenced relative
600
- to either another side effect on the same memory location or a value
601
- computation using the value of any object in the same memory location,
602
- and they are not potentially concurrent ([[intro.multithread]]), the
603
- behavior is undefined.
604
-
605
- [*Note 9*: The next section imposes similar, but more complex
606
- restrictions on potentially concurrent computations. — *end note*]
607
-
608
- [*Example 3*:
609
-
610
- ``` cpp
611
- void g(int i) {
612
- i = 7, i++, i++; // i becomes 9
613
-
614
- i = i++ + 1; // the value of i is incremented
615
- i = i++ + i; // the behavior is undefined
616
- i = i + 1; // the value of i is incremented
617
- }
618
- ```
619
-
620
- — *end example*]
621
-
622
- When calling a function (whether or not the function is inline), every
623
- value computation and side effect associated with any argument
624
- expression, or with the postfix expression designating the called
625
- function, is sequenced before execution of every expression or statement
626
- in the body of the called function. For each function invocation *F*,
627
- for every evaluation *A* that occurs within *F* and every evaluation *B*
628
- that does not occur within *F* but is evaluated on the same thread and
629
- as part of the same signal handler (if any), either *A* is sequenced
630
- before *B* or *B* is sequenced before *A*.[^10]
631
-
632
- [*Note 10*: If *A* and *B* would not otherwise be sequenced then they
633
- are indeterminately sequenced. — *end note*]
634
-
635
- Several contexts in C++cause evaluation of a function call, even though
636
- no corresponding function call syntax appears in the translation unit.
637
-
638
- [*Example 4*: Evaluation of a *new-expression* invokes one or more
639
- allocation and constructor functions; see  [[expr.new]]. For another
640
- example, invocation of a conversion function ([[class.conv.fct]]) can
641
- arise in contexts in which no function call syntax
642
- appears. — *end example*]
643
-
644
- The sequencing constraints on the execution of the called function (as
645
- described above) are features of the function calls as evaluated,
646
- whatever the syntax of the expression that calls the function might be.
647
-
648
- If a signal handler is executed as a result of a call to the
649
- `std::raise` function, then the execution of the handler is sequenced
650
- after the invocation of the `std::raise` function and before its return.
651
-
652
- [*Note 11*: When a signal is received for another reason, the execution
653
- of the signal handler is usually unsequenced with respect to the rest of
654
- the program. — *end note*]
655
-
656
- ## Multi-threaded executions and data races <a id="intro.multithread">[[intro.multithread]]</a>
657
-
658
- A *thread of execution* (also known as a *thread*) is a single flow of
659
- control within a program, including the initial invocation of a specific
660
- top-level function, and recursively including every function invocation
661
- subsequently executed by the thread.
662
-
663
- [*Note 1*: When one thread creates another, the initial call to the
664
- top-level function of the new thread is executed by the new thread, not
665
- by the creating thread. — *end note*]
666
-
667
- Every thread in a program can potentially access every object and
668
- function in a program.[^11] Under a hosted implementation, a C++program
669
- can have more than one thread running concurrently. The execution of
670
- each thread proceeds as defined by the remainder of this International
671
- Standard. The execution of the entire program consists of an execution
672
- of all of its threads.
673
-
674
- [*Note 2*: Usually the execution can be viewed as an interleaving of
675
- all its threads. However, some kinds of atomic operations, for example,
676
- allow executions inconsistent with a simple interleaving, as described
677
- below. — *end note*]
678
-
679
- Under a freestanding implementation, it is *implementation-defined*
680
- whether a program can have more than one thread of execution.
681
-
682
- For a signal handler that is not executed as a result of a call to the
683
- `std::raise` function, it is unspecified which thread of execution
684
- contains the signal handler invocation.
685
-
686
- ### Data races <a id="intro.races">[[intro.races]]</a>
687
-
688
- The value of an object visible to a thread *T* at a particular point is
689
- the initial value of the object, a value assigned to the object by *T*,
690
- or a value assigned to the object by another thread, according to the
691
- rules below.
692
-
693
- [*Note 1*: In some cases, there may instead be undefined behavior. Much
694
- of this section is motivated by the desire to support atomic operations
695
- with explicit and detailed visibility constraints. However, it also
696
- implicitly supports a simpler view for more restricted
697
- programs. — *end note*]
698
-
699
- Two expression evaluations *conflict* if one of them modifies a memory
700
- location ([[intro.memory]]) and the other one reads or modifies the
701
- same memory location.
702
-
703
- The library defines a number of atomic operations (Clause  [[atomics]])
704
- and operations on mutexes (Clause  [[thread]]) that are specially
705
- identified as synchronization operations. These operations play a
706
- special role in making assignments in one thread visible to another. A
707
- synchronization operation on one or more memory locations is either a
708
- consume operation, an acquire operation, a release operation, or both an
709
- acquire and release operation. A synchronization operation without an
710
- associated memory location is a fence and can be either an acquire
711
- fence, a release fence, or both an acquire and release fence. In
712
- addition, there are relaxed atomic operations, which are not
713
- synchronization operations, and atomic read-modify-write operations,
714
- which have special characteristics.
715
-
716
- [*Note 2*: For example, a call that acquires a mutex will perform an
717
- acquire operation on the locations comprising the mutex.
718
- Correspondingly, a call that releases the same mutex will perform a
719
- release operation on those same locations. Informally, performing a
720
- release operation on *A* forces prior side effects on other memory
721
- locations to become visible to other threads that later perform a
722
- consume or an acquire operation on *A*. “Relaxed” atomic operations are
723
- not synchronization operations even though, like synchronization
724
- operations, they cannot contribute to data races. — *end note*]
725
-
726
- All modifications to a particular atomic object *M* occur in some
727
- particular total order, called the *modification order* of *M*.
728
-
729
- [*Note 3*: There is a separate order for each atomic object. There is
730
- no requirement that these can be combined into a single total order for
731
- all objects. In general this will be impossible since different threads
732
- may observe modifications to different objects in inconsistent
733
- orders. — *end note*]
734
-
735
- A *release sequence* headed by a release operation *A* on an atomic
736
- object *M* is a maximal contiguous sub-sequence of side effects in the
737
- modification order of *M*, where the first operation is `A`, and every
738
- subsequent operation
739
-
740
- - is performed by the same thread that performed `A`, or
741
- - is an atomic read-modify-write operation.
742
-
743
- Certain library calls *synchronize with* other library calls performed
744
- by another thread. For example, an atomic store-release synchronizes
745
- with a load-acquire that takes its value from the store (
746
- [[atomics.order]]).
747
-
748
- [*Note 4*: Except in the specified cases, reading a later value does
749
- not necessarily ensure visibility as described below. Such a requirement
750
- would sometimes interfere with efficient implementation. — *end note*]
751
-
752
- [*Note 5*: The specifications of the synchronization operations define
753
- when one reads the value written by another. For atomic objects, the
754
- definition is clear. All operations on a given mutex occur in a single
755
- total order. Each mutex acquisition “reads the value written” by the
756
- last mutex release. — *end note*]
757
-
758
- An evaluation *A* *carries a dependency* to an evaluation *B* if
759
-
760
- - the value of *A* is used as an operand of *B*, unless:
761
- - *B* is an invocation of any specialization of
762
- `std::kill_dependency` ([[atomics.order]]), or
763
- - *A* is the left operand of a built-in logical AND (`&&`, see 
764
- [[expr.log.and]]) or logical OR (`||`, see  [[expr.log.or]])
765
- operator, or
766
- - *A* is the left operand of a conditional (`?:`, see  [[expr.cond]])
767
- operator, or
768
- - *A* is the left operand of the built-in comma (`,`) operator (
769
- [[expr.comma]]);
770
-
771
- or
772
- - *A* writes a scalar object or bit-field *M*, *B* reads the value
773
- written by *A* from *M*, and *A* is sequenced before *B*, or
774
- - for some evaluation *X*, *A* carries a dependency to *X*, and *X*
775
- carries a dependency to *B*.
776
-
777
- [*Note 6*: “Carries a dependency to” is a subset of “is sequenced
778
- before”, and is similarly strictly intra-thread. — *end note*]
779
-
780
- An evaluation *A* is *dependency-ordered before* an evaluation *B* if
781
-
782
- - *A* performs a release operation on an atomic object *M*, and, in
783
- another thread, *B* performs a consume operation on *M* and reads a
784
- value written by any side effect in the release sequence headed by
785
- *A*, or
786
- - for some evaluation *X*, *A* is dependency-ordered before *X* and *X*
787
- carries a dependency to *B*.
788
-
789
- [*Note 7*: The relation “is dependency-ordered before” is analogous to
790
- “synchronizes with”, but uses release/consume in place of
791
- release/acquire. — *end note*]
792
-
793
- An evaluation *A* *inter-thread happens before* an evaluation *B* if
794
-
795
- - *A* synchronizes with *B*, or
796
- - *A* is dependency-ordered before *B*, or
797
- - for some evaluation *X*
798
- - *A* synchronizes with *X* and *X* is sequenced before *B*, or
799
- - *A* is sequenced before *X* and *X* inter-thread happens before *B*,
800
- or
801
- - *A* inter-thread happens before *X* and *X* inter-thread happens
802
- before *B*.
803
-
804
- [*Note 8*: The “inter-thread happens before” relation describes
805
- arbitrary concatenations of “sequenced before”, “synchronizes with” and
806
- “dependency-ordered before” relationships, with two exceptions. The
807
- first exception is that a concatenation is not permitted to end with
808
- “dependency-ordered before” followed by “sequenced before”. The reason
809
- for this limitation is that a consume operation participating in a
810
- “dependency-ordered before” relationship provides ordering only with
811
- respect to operations to which this consume operation actually carries a
812
- dependency. The reason that this limitation applies only to the end of
813
- such a concatenation is that any subsequent release operation will
814
- provide the required ordering for a prior consume operation. The second
815
- exception is that a concatenation is not permitted to consist entirely
816
- of “sequenced before”. The reasons for this limitation are (1) to permit
817
- “inter-thread happens before” to be transitively closed and (2) the
818
- “happens before” relation, defined below, provides for relationships
819
- consisting entirely of “sequenced before”. — *end note*]
820
-
821
- An evaluation *A* *happens before* an evaluation *B* (or, equivalently,
822
- *B* *happens after* *A*) if:
823
-
824
- - *A* is sequenced before *B*, or
825
- - *A* inter-thread happens before *B*.
826
-
827
- The implementation shall ensure that no program execution demonstrates a
828
- cycle in the “happens before” relation.
829
-
830
- [*Note 9*: This cycle would otherwise be possible only through the use
831
- of consume operations. — *end note*]
832
-
833
- An evaluation *A* *strongly happens before* an evaluation *B* if either
834
-
835
- - *A* is sequenced before *B*, or
836
- - *A* synchronizes with *B*, or
837
- - *A* strongly happens before *X* and *X* strongly happens before *B*.
838
-
839
- [*Note 10*: In the absence of consume operations, the happens before
840
- and strongly happens before relations are identical. Strongly happens
841
- before essentially excludes consume operations. — *end note*]
842
-
843
- A *visible side effect* *A* on a scalar object or bit-field *M* with
844
- respect to a value computation *B* of *M* satisfies the conditions:
845
-
846
- - *A* happens before *B* and
847
- - there is no other side effect *X* to *M* such that *A* happens before
848
- *X* and *X* happens before *B*.
849
-
850
- The value of a non-atomic scalar object or bit-field *M*, as determined
851
- by evaluation *B*, shall be the value stored by the visible side effect
852
- *A*.
853
-
854
- [*Note 11*: If there is ambiguity about which side effect to a
855
- non-atomic object or bit-field is visible, then the behavior is either
856
- unspecified or undefined. — *end note*]
857
-
858
- [*Note 12*: This states that operations on ordinary objects are not
859
- visibly reordered. This is not actually detectable without data races,
860
- but it is necessary to ensure that data races, as defined below, and
861
- with suitable restrictions on the use of atomics, correspond to data
862
- races in a simple interleaved (sequentially consistent)
863
- execution. — *end note*]
864
-
865
- The value of an atomic object *M*, as determined by evaluation *B*,
866
- shall be the value stored by some side effect *A* that modifies *M*,
867
- where *B* does not happen before *A*.
868
-
869
- [*Note 13*: The set of such side effects is also restricted by the rest
870
- of the rules described here, and in particular, by the coherence
871
- requirements below. — *end note*]
872
-
873
- If an operation *A* that modifies an atomic object *M* happens before an
874
- operation *B* that modifies *M*, then *A* shall be earlier than *B* in
875
- the modification order of *M*.
876
-
877
- [*Note 14*: This requirement is known as write-write
878
- coherence. — *end note*]
879
-
880
- If a value computation *A* of an atomic object *M* happens before a
881
- value computation *B* of *M*, and *A* takes its value from a side effect
882
- *X* on *M*, then the value computed by *B* shall either be the value
883
- stored by *X* or the value stored by a side effect *Y* on *M*, where *Y*
884
- follows *X* in the modification order of *M*.
885
-
886
- [*Note 15*: This requirement is known as read-read
887
- coherence. — *end note*]
888
-
889
- If a value computation *A* of an atomic object *M* happens before an
890
- operation *B* that modifies *M*, then *A* shall take its value from a
891
- side effect *X* on *M*, where *X* precedes *B* in the modification order
892
- of *M*.
893
-
894
- [*Note 16*: This requirement is known as read-write
895
- coherence. — *end note*]
896
-
897
- If a side effect *X* on an atomic object *M* happens before a value
898
- computation *B* of *M*, then the evaluation *B* shall take its value
899
- from *X* or from a side effect *Y* that follows *X* in the modification
900
- order of *M*.
901
-
902
- [*Note 17*: This requirement is known as write-read
903
- coherence. — *end note*]
904
-
905
- [*Note 18*: The four preceding coherence requirements effectively
906
- disallow compiler reordering of atomic operations to a single object,
907
- even if both operations are relaxed loads. This effectively makes the
908
- cache coherence guarantee provided by most hardware available to
909
- C++atomic operations. — *end note*]
910
-
911
- [*Note 19*: The value observed by a load of an atomic depends on the
912
- “happens before” relation, which depends on the values observed by loads
913
- of atomics. The intended reading is that there must exist an association
914
- of atomic loads with modifications they observe that, together with
915
- suitably chosen modification orders and the “happens before” relation
916
- derived as described above, satisfy the resulting constraints as imposed
917
- here. — *end note*]
918
-
919
- Two actions are *potentially concurrent* if
920
-
921
- - they are performed by different threads, or
922
- - they are unsequenced, at least one is performed by a signal handler,
923
- and they are not both performed by the same signal handler invocation.
924
-
925
- The execution of a program contains a *data race* if it contains two
926
- potentially concurrent conflicting actions, at least one of which is not
927
- atomic, and neither happens before the other, except for the special
928
- case for signal handlers described below. Any such data race results in
929
- undefined behavior.
930
-
931
- [*Note 20*: It can be shown that programs that correctly use mutexes
932
- and `memory_order_seq_cst` operations to prevent all data races and use
933
- no other synchronization operations behave as if the operations executed
934
- by their constituent threads were simply interleaved, with each value
935
- computation of an object being taken from the last side effect on that
936
- object in that interleaving. This is normally referred to as “sequential
937
- consistency”. However, this applies only to data-race-free programs, and
938
- data-race-free programs cannot observe most program transformations that
939
- do not change single-threaded program semantics. In fact, most
940
- single-threaded program transformations continue to be allowed, since
941
- any program that behaves differently as a result must perform an
942
- undefined operation. — *end note*]
943
-
944
- Two accesses to the same object of type `volatile std::sig_atomic_t` do
945
- not result in a data race if both occur in the same thread, even if one
946
- or more occurs in a signal handler. For each signal handler invocation,
947
- evaluations performed by the thread invoking a signal handler can be
948
- divided into two groups *A* and *B*, such that no evaluations in *B*
949
- happen before evaluations in *A*, and the evaluations of such
950
- `volatile std::sig_atomic_t` objects take values as though all
951
- evaluations in *A* happened before the execution of the signal handler
952
- and the execution of the signal handler happened before all evaluations
953
- in *B*.
954
-
955
- [*Note 21*: Compiler transformations that introduce assignments to a
956
- potentially shared memory location that would not be modified by the
957
- abstract machine are generally precluded by this International Standard,
958
- since such an assignment might overwrite another assignment by a
959
- different thread in cases in which an abstract machine execution would
960
- not have encountered a data race. This includes implementations of data
961
- member assignment that overwrite adjacent members in separate memory
962
- locations. Reordering of atomic loads in cases in which the atomics in
963
- question may alias is also generally precluded, since this may violate
964
- the coherence rules. — *end note*]
965
-
966
- [*Note 22*: Transformations that introduce a speculative read of a
967
- potentially shared memory location may not preserve the semantics of the
968
- C++program as defined in this International Standard, since they
969
- potentially introduce a data race. However, they are typically valid in
970
- the context of an optimizing compiler that targets a specific machine
971
- with well-defined semantics for data races. They would be invalid for a
972
- hypothetical machine that is not tolerant of races or provides hardware
973
- race detection. — *end note*]
974
-
975
- ### Forward progress <a id="intro.progress">[[intro.progress]]</a>
976
-
977
- The implementation may assume that any thread will eventually do one of
978
- the following:
979
-
980
- - terminate,
981
- - make a call to a library I/O function,
982
- - perform an access through a volatile glvalue, or
983
- - perform a synchronization operation or an atomic operation.
984
-
985
- [*Note 1*: This is intended to allow compiler transformations such as
986
- removal of empty loops, even when termination cannot be
987
- proven. — *end note*]
988
-
989
- Executions of atomic functions that are either defined to be lock-free (
990
- [[atomics.flag]]) or indicated as lock-free ([[atomics.lockfree]]) are
991
- *lock-free executions*.
992
-
993
- - If there is only one thread that is not blocked ([[defns.block]]) in
994
- a standard library function, a lock-free execution in that thread
995
- shall complete. \[*Note 2*: Concurrently executing threads may prevent
996
- progress of a lock-free execution. For example, this situation can
997
- occur with load-locked store-conditional implementations. This
998
- property is sometimes termed obstruction-free. — *end note*]
999
- - When one or more lock-free executions run concurrently, at least one
1000
- should complete. \[*Note 3*: It is difficult for some implementations
1001
- to provide absolute guarantees to this effect, since repeated and
1002
- particularly inopportune interference from other threads may prevent
1003
- forward progress, e.g., by repeatedly stealing a cache line for
1004
- unrelated purposes between load-locked and store-conditional
1005
- instructions. Implementations should ensure that such effects cannot
1006
- indefinitely delay progress under expected operating conditions, and
1007
- that such anomalies can therefore safely be ignored by programmers.
1008
- Outside this document, this property is sometimes termed
1009
- lock-free. — *end note*]
1010
-
1011
- During the execution of a thread of execution, each of the following is
1012
- termed an *execution step*:
1013
-
1014
- - termination of the thread of execution,
1015
- - performing an access through a volatile glvalue, or
1016
- - completion of a call to a library I/O function, a synchronization
1017
- operation, or an atomic operation.
1018
-
1019
- An invocation of a standard library function that blocks (
1020
- [[defns.block]]) is considered to continuously execute execution steps
1021
- while waiting for the condition that it blocks on to be satisfied.
1022
-
1023
- [*Example 1*: A library I/O function that blocks until the I/O
1024
- operation is complete can be considered to continuously check whether
1025
- the operation is complete. Each such check might consist of one or more
1026
- execution steps, for example using observable behavior of the abstract
1027
- machine. — *end example*]
1028
-
1029
- [*Note 4*: Because of this and the preceding requirement regarding what
1030
- threads of execution have to perform eventually, it follows that no
1031
- thread of execution can execute forever without an execution step
1032
- occurring. — *end note*]
1033
-
1034
- A thread of execution *makes progress* when an execution step occurs or
1035
- a lock-free execution does not complete because there are other
1036
- concurrent threads that are not blocked in a standard library function
1037
- (see above).
1038
-
1039
- For a thread of execution providing *concurrent forward progress
1040
- guarantees*, the implementation ensures that the thread will eventually
1041
- make progress for as long as it has not terminated.
1042
-
1043
- [*Note 5*: This is required regardless of whether or not other threads
1044
- of executions (if any) have been or are making progress. To eventually
1045
- fulfill this requirement means that this will happen in an unspecified
1046
- but finite amount of time. — *end note*]
1047
-
1048
- It is *implementation-defined* whether the implementation-created thread
1049
- of execution that executes `main` ([[basic.start.main]]) and the
1050
- threads of execution created by `std::thread` ([[thread.thread.class]])
1051
- provide concurrent forward progress guarantees.
1052
-
1053
- [*Note 6*: General-purpose implementations are encouraged to provide
1054
- these guarantees. — *end note*]
1055
-
1056
- For a thread of execution providing *parallel forward progress
1057
- guarantees*, the implementation is not required to ensure that the
1058
- thread will eventually make progress if it has not yet executed any
1059
- execution step; once this thread has executed a step, it provides
1060
- concurrent forward progress guarantees.
1061
-
1062
- [*Note 7*: This does not specify a requirement for when to start this
1063
- thread of execution, which will typically be specified by the entity
1064
- that creates this thread of execution. For example, a thread of
1065
- execution that provides concurrent forward progress guarantees and
1066
- executes tasks from a set of tasks in an arbitrary order, one after the
1067
- other, satisfies the requirements of parallel forward progress for these
1068
- tasks. — *end note*]
1069
-
1070
- For a thread of execution providing *weakly parallel forward progress
1071
- guarantees*, the implementation does not ensure that the thread will
1072
- eventually make progress.
1073
-
1074
- [*Note 8*: Threads of execution providing weakly parallel forward
1075
- progress guarantees cannot be expected to make progress regardless of
1076
- whether other threads make progress or not; however, blocking with
1077
- forward progress guarantee delegation, as defined below, can be used to
1078
- ensure that such threads of execution make progress
1079
- eventually. — *end note*]
1080
-
1081
- Concurrent forward progress guarantees are stronger than parallel
1082
- forward progress guarantees, which in turn are stronger than weakly
1083
- parallel forward progress guarantees.
1084
-
1085
- [*Note 9*: For example, some kinds of synchronization between threads
1086
- of execution may only make progress if the respective threads of
1087
- execution provide parallel forward progress guarantees, but will fail to
1088
- make progress under weakly parallel guarantees. — *end note*]
1089
-
1090
- When a thread of execution *P* is specified to *block with forward
1091
- progress guarantee delegation* on the completion of a set *S* of threads
1092
- of execution, then throughout the whole time of *P* being blocked on
1093
- *S*, the implementation shall ensure that the forward progress
1094
- guarantees provided by at least one thread of execution in *S* is at
1095
- least as strong as *P*’s forward progress guarantees.
1096
-
1097
- [*Note 10*: It is unspecified which thread or threads of execution in
1098
- *S* are chosen and for which number of execution steps. The
1099
- strengthening is not permanent and not necessarily in place for the rest
1100
- of the lifetime of the affected thread of execution. As long as *P* is
1101
- blocked, the implementation has to eventually select and potentially
1102
- strengthen a thread of execution in *S*. — *end note*]
1103
-
1104
- Once a thread of execution in *S* terminates, it is removed from *S*.
1105
- Once *S* is empty, *P* is unblocked.
1106
-
1107
- [*Note 11*: A thread of execution *B* thus can temporarily provide an
1108
- effectively stronger forward progress guarantee for a certain amount of
1109
- time, due to a second thread of execution *A* being blocked on it with
1110
- forward progress guarantee delegation. In turn, if *B* then blocks with
1111
- forward progress guarantee delegation on *C*, this may also temporarily
1112
- provide a stronger forward progress guarantee to *C*. — *end note*]
1113
-
1114
- [*Note 12*: If all threads of execution in *S* finish executing (e.g.,
1115
- they terminate and do not use blocking synchronization incorrectly),
1116
- then *P*’s execution of the operation that blocks with forward progress
1117
- guarantee delegation will not result in *P*’s progress guarantee being
1118
- effectively weakened. — *end note*]
1119
-
1120
- [*Note 13*: This does not remove any constraints regarding blocking
1121
- synchronization for threads of execution providing parallel or weakly
1122
- parallel forward progress guarantees because the implementation is not
1123
- required to strengthen a particular thread of execution whose too-weak
1124
- progress guarantee is preventing overall progress. — *end note*]
1125
-
1126
- An implementation should ensure that the last value (in modification
1127
- order) assigned by an atomic or synchronization operation will become
1128
- visible to all other threads in a finite period of time.
1129
 
1130
  ## Acknowledgments <a id="intro.ack">[[intro.ack]]</a>
1131
 
1132
  The C++ programming language as described in this document is based on
1133
  the language as described in Chapter R (Reference Manual) of Stroustrup:
1134
- *The C++Programming Language* (second edition, Addison-Wesley Publishing
1135
- Company, ISBN 0-201-53992-6, copyright ©1991 AT&T). That, in turn, is
1136
- based on the C programming language as described in Appendix A of
1137
- Kernighan and Ritchie: *The C Programming Language* (Prentice-Hall,
1138
  1978, ISBN 0-13-110163-3, copyright ©1978 AT&T).
1139
 
1140
  Portions of the library Clauses of this document are based on work by
1141
  P.J. Plauger, which was published as *The Draft Standard C++ Library*
1142
  (Prentice-Hall, ISBN 0-13-117003-1, copyright ©1995 P.J. Plauger).
@@ -1144,133 +193,84 @@ P.J. Plauger, which was published as *The Draft Standard C++Library*
1144
  POSIX® is a registered trademark of the Institute of Electrical and
1145
  Electronic Engineers, Inc.
1146
 
1147
  ECMAScript® is a registered trademark of Ecma International.
1148
 
 
 
1149
  All rights in these originals are reserved.
1150
 
1151
  <!-- Link reference definitions -->
1152
- [atomics]: atomics.md#atomics
1153
- [atomics.flag]: atomics.md#atomics.flag
1154
- [atomics.lockfree]: atomics.md#atomics.lockfree
1155
- [atomics.order]: atomics.md#atomics.order
1156
- [basic]: basic.md#basic
1157
- [basic.compound]: basic.md#basic.compound
1158
- [basic.def]: basic.md#basic.def
1159
  [basic.def.odr]: basic.md#basic.def.odr
1160
- [basic.life]: basic.md#basic.life
1161
  [basic.link]: basic.md#basic.link
1162
- [basic.lval]: basic.md#basic.lval
1163
  [basic.namespace]: dcl.md#basic.namespace
1164
- [basic.start.main]: basic.md#basic.start.main
1165
- [basic.stc]: basic.md#basic.stc
1166
- [basic.stc.auto]: basic.md#basic.stc.auto
1167
  [basic.types]: basic.md#basic.types
1168
  [class.access]: class.md#class.access
1169
- [class.base.init]: special.md#class.base.init
1170
- [class.bit]: class.md#class.bit
1171
- [class.cdtor]: special.md#class.cdtor
1172
- [class.conv.fct]: special.md#class.conv.fct
1173
  [class.derived]: class.md#class.derived
1174
- [class.mem]: class.md#class.mem
1175
- [class.temporary]: special.md#class.temporary
1176
- [class.union]: class.md#class.union
1177
- [class.virtual]: class.md#class.virtual
1178
  [compliance]: library.md#compliance
1179
- [conv.rval]: conv.md#conv.rval
1180
  [cpp]: cpp.md#cpp
1181
- [cpp.include]: cpp.md#cpp.include
1182
  [cpp.replace]: cpp.md#cpp.replace
1183
- [cstddef.syn]: language.md#cstddef.syn
1184
  [dcl.decl]: dcl.md#dcl.decl
1185
  [dcl.fct]: dcl.md#dcl.fct
1186
- [dcl.fct.default]: dcl.md#dcl.fct.default
1187
- [dcl.init.aggr]: dcl.md#dcl.init.aggr
1188
  [dcl.ptr]: dcl.md#dcl.ptr
1189
  [dcl.ref]: dcl.md#dcl.ref
1190
  [definitions]: library.md#definitions
1191
- [defns.block]: #defns.block
1192
  [defns.well.formed]: #defns.well.formed
1193
  [depr]: future.md#depr
 
1194
  [diff]: compatibility.md#diff
1195
  [diff.library]: compatibility.md#diff.library
1196
- [expr]: expr.md#expr
1197
  [expr.call]: expr.md#expr.call
1198
- [expr.comma]: expr.md#expr.comma
1199
- [expr.cond]: expr.md#expr.cond
1200
  [expr.const]: expr.md#expr.const
1201
- [expr.log.and]: expr.md#expr.log.and
1202
- [expr.log.or]: expr.md#expr.log.or
1203
- [expr.new]: expr.md#expr.new
1204
- [expr.prim.lambda]: expr.md#expr.prim.lambda
1205
  [expr.throw]: expr.md#expr.throw
1206
  [gram]: grammar.md#gram
1207
  [implimits]: limits.md#implimits
1208
  [intro]: #intro
 
1209
  [intro.ack]: #intro.ack
1210
  [intro.compliance]: #intro.compliance
1211
  [intro.defs]: #intro.defs
1212
- [intro.execution]: #intro.execution
1213
- [intro.memory]: #intro.memory
1214
- [intro.multithread]: #intro.multithread
1215
- [intro.object]: #intro.object
1216
- [intro.progress]: #intro.progress
1217
- [intro.races]: #intro.races
1218
  [intro.refs]: #intro.refs
1219
  [intro.scope]: #intro.scope
1220
  [intro.structure]: #intro.structure
1221
- [language.support]: language.md#language.support
1222
  [lex]: lex.md#lex
1223
  [lex.charset]: lex.md#lex.charset
1224
  [lex.phases]: lex.md#lex.phases
1225
  [library]: library.md#library
 
 
1226
  [syntax]: #syntax
1227
  [temp.arg]: temp.md#temp.arg
1228
  [temp.deduct]: temp.md#temp.deduct
1229
  [thread]: thread.md#thread
1230
- [thread.thread.class]: thread.md#thread.thread.class
1231
 
1232
- [^1]: With the qualifications noted in Clauses  [[language.support]]
1233
- through  [[thread]] and in  [[diff.library]], the C standard library
1234
- is a subset of the C++standard library.
1235
 
1236
  [^2]: “Correct execution” can include undefined behavior, depending on
1237
- the data being processed; see Clause  [[intro.defs]] and 
1238
  [[intro.execution]].
1239
 
1240
  [^3]: This documentation also defines implementation-defined behavior;
1241
- see  [[intro.execution]].
1242
-
1243
- [^4]: The number of bits in a byte is reported by the macro `CHAR_BIT`
1244
- in the header `<climits>`.
1245
-
1246
- [^5]: Under the “as-if” rule an implementation is allowed to store two
1247
- objects at the same machine address or not store an object at all if
1248
- the program cannot observe the difference ([[intro.execution]]).
1249
-
1250
- [^6]: This provision is sometimes called the “as-if” rule, because an
1251
- implementation is free to disregard any requirement of this
1252
- International Standard as long as the result is *as if* the
1253
- requirement had been obeyed, as far as can be determined from the
1254
- observable behavior of the program. For instance, an actual
1255
- implementation need not evaluate part of an expression if it can
1256
- deduce that its value is not used and that no side effects affecting
1257
- the observable behavior of the program are produced.
1258
-
1259
- [^7]: This documentation also includes conditionally-supported
1260
  constructs and locale-specific behavior. See  [[intro.compliance]].
1261
-
1262
- [^8]: Overloaded operators are never assumed to be associative or
1263
- commutative.
1264
-
1265
- [^9]: As specified in  [[class.temporary]], after a full-expression is
1266
- evaluated, a sequence of zero or more invocations of destructor
1267
- functions for temporary objects takes place, usually in reverse
1268
- order of the construction of each temporary object.
1269
-
1270
- [^10]: In other words, function executions do not interleave with each
1271
- other.
1272
-
1273
- [^11]: An object with automatic or thread storage duration (
1274
- [[basic.stc]]) is associated with one specific thread, and can be
1275
- accessed by a different thread only indirectly through a pointer or
1276
- reference ([[basic.compound]]).
 
1
  # General principles <a id="intro">[[intro]]</a>
2
 
3
  ## Implementation compliance <a id="intro.compliance">[[intro.compliance]]</a>
4
 
5
  The set of *diagnosable rules* consists of all syntactic and semantic
6
+ rules in this document except for those rules containing an explicit
7
+ notation that “no diagnostic is required” or which are described as
8
+ resulting in “undefined behavior”.
9
 
10
+ Although this document states only requirements on C++ implementations,
11
+ those requirements are often easier to understand if they are phrased as
12
+ requirements on programs, parts of programs, or execution of programs.
13
+ Such requirements have the following meaning:
14
 
15
+ - If a program contains no violations of the rules in this document, a
16
+ conforming implementation shall, within its resource limits, accept
17
+ and correctly execute[^2] that program.
18
  - If a program contains a violation of any diagnosable rule or an
19
+ occurrence of a construct described in this document as
20
  “conditionally-supported” when the implementation does not support
21
  that construct, a conforming implementation shall issue at least one
22
  diagnostic message.
23
  - If a program contains a violation of a rule for which no diagnostic is
24
+ required, this document places no requirement on implementations with
25
+ respect to that program.
26
 
27
  [*Note 1*: During template argument deduction and substitution, certain
28
  constructs that in other contexts require a diagnostic are treated
29
  differently; see  [[temp.deduct]]. — *end note*]
30
 
31
  For classes and class templates, the library Clauses specify partial
32
+ definitions. Private members [[class.access]] are not specified, but
33
+ each implementation shall supply them to complete the definitions
34
+ according to the description in the library Clauses.
35
 
36
  For functions, function templates, objects, and values, the library
37
  Clauses specify declarations. Implementations shall supply definitions
38
  consistent with the descriptions in the library Clauses.
39
 
40
+ The names defined in the library have namespace scope
41
+ [[basic.namespace]]. A C++ translation unit [[lex.phases]] obtains
42
  access to these names by including the appropriate standard library
43
+ header or importing the appropriate standard library named header unit
44
+ [[using.headers]].
45
 
46
  The templates, classes, functions, and objects in the library have
47
+ external linkage [[basic.link]]. The implementation provides definitions
48
+ for standard library entities, as necessary, while combining translation
49
+ units to form a complete C++ program [[lex.phases]].
50
 
51
  Two kinds of implementations are defined: a *hosted implementation* and
52
  a *freestanding implementation*. For a hosted implementation, this
53
+ document defines the set of available libraries. A freestanding
54
+ implementation is one in which execution may take place without the
55
+ benefit of an operating system, and has an *implementation-defined* set
56
+ of libraries that includes certain language-support libraries
57
+ [[compliance]].
58
 
59
  A conforming implementation may have extensions (including additional
60
  library functions), provided they do not alter the behavior of any
61
  well-formed program. Implementations are required to diagnose programs
62
+ that use such extensions that are ill-formed according to this document.
63
+ Having done so, however, they can compile and execute such programs.
 
64
 
65
  Each implementation shall include documentation that identifies all
66
  conditionally-supported constructs that it does not support and defines
67
  all locale-specific characteristics.[^3]
68
 
69
+ ### Abstract machine <a id="intro.abstract">[[intro.abstract]]</a>
70
+
71
+ The semantic descriptions in this document define a parameterized
72
+ nondeterministic abstract machine. This document places no requirement
73
+ on the structure of conforming implementations. In particular, they need
74
+ not copy or emulate the structure of the abstract machine. Rather,
75
+ conforming implementations are required to emulate (only) the observable
76
+ behavior of the abstract machine as explained below.[^4]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
 
78
  Certain aspects and operations of the abstract machine are described in
79
+ this document as implementation-defined (for example, `sizeof(int)`).
80
+ These constitute the parameters of the abstract machine. Each
81
+ implementation shall include documentation describing its
82
+ characteristics and behavior in these respects.[^5] Such documentation
83
  shall define the instance of the abstract machine that corresponds to
84
  that implementation (referred to as the “corresponding instance” below).
85
 
86
  Certain other aspects and operations of the abstract machine are
87
+ described in this document as unspecified (for example, order of
88
+ evaluation of arguments in a function call [[expr.call]]). Where
89
+ possible, this document defines a set of allowable behaviors. These
 
90
  define the nondeterministic aspects of the abstract machine. An instance
91
  of the abstract machine can thus have more than one possible execution
92
  for a given program and a given input.
93
 
94
+ Certain other operations are described in this document as undefined
95
+ (for example, the effect of attempting to modify a const object).
 
96
 
97
+ [*Note 1*: This document imposes no requirements on the behavior of
98
+ programs that contain undefined behavior. — *end note*]
99
 
100
  A conforming implementation executing a well-formed program shall
101
  produce the same observable behavior as one of the possible executions
102
  of the corresponding instance of the abstract machine with the same
103
  program and the same input. However, if any such execution contains an
104
+ undefined operation, this document places no requirement on the
105
+ implementation executing that program with that input (not even with
106
+ regard to operations preceding the first undefined operation).
 
 
 
 
 
 
107
 
108
  The least requirements on a conforming implementation are:
109
 
110
  - Accesses through volatile glvalues are evaluated strictly according to
111
  the rules of the abstract machine.
 
121
  program.
122
 
123
  [*Note 2*: More stringent correspondences between abstract and actual
124
  semantics may be defined by each implementation. — *end note*]
125
 
126
+ ## Structure of this document <a id="intro.structure">[[intro.structure]]</a>
127
+
128
+ [[lex]] through [[cpp]] describe the C++ programming language. That
129
+ description includes detailed syntactic specifications in a form
130
+ described in  [[syntax]]. For convenience, [[gram]] repeats all such
131
+ syntactic specifications.
132
+
133
+ [[support]] through [[thread]] and [[depr]] (the *library clauses*)
134
+ describe the C++ standard library. That description includes detailed
135
+ descriptions of the entities and macros that constitute the library, in
136
+ a form described in [[library]].
137
+
138
+ [[implimits]] recommends lower bounds on the capacity of conforming
139
+ implementations.
140
+
141
+ [[diff]] summarizes the evolution of C++ since its first published
142
+ description, and explains in detail the differences between C++ and C.
143
+ Certain features of C++ exist solely for compatibility purposes;
144
+ [[depr]] describes those features.
145
+
146
+ Throughout this document, each example is introduced by “” and
147
+ terminated by “”. Each note is introduced by “” or “” and terminated by
148
+ “”. Examples and notes may be nested.
149
+
150
+ ## Syntax notation <a id="syntax">[[syntax]]</a>
151
+
152
+ In the syntax notation used in this document, syntactic categories are
153
+ indicated by *italic* type, and literal words and characters in
154
+ `constant` `width` type. Alternatives are listed on separate lines
155
+ except in a few cases where a long set of alternatives is marked by the
156
+ phrase “one of”. If the text of an alternative is too long to fit on a
157
+ line, the text is continued on subsequent lines indented from the first
158
+ one. An optional terminal or non-terminal symbol is indicated by the
159
+ subscript “\relaxₒₚₜ ”, so
160
+
161
+ ``` bnf
162
+ '{' expressionₒₚₜ '}'
163
+ ```
164
+
165
+ indicates an optional expression enclosed in braces.
166
+
167
+ Names for syntactic categories have generally been chosen according to
168
+ the following rules:
169
+
170
+ - *X-name* is a use of an identifier in a context that determines its
171
+ meaning (e.g., *class-name*, *typedef-name*).
172
+ - *X-id* is an identifier with no context-dependent meaning (e.g.,
173
+ *qualified-id*).
174
+ - *X-seq* is one or more *X*’s without intervening delimiters (e.g.,
175
+ *declaration-seq* is a sequence of declarations).
176
+ - *X-list* is one or more *X*’s separated by intervening commas (e.g.,
177
+ *identifier-list* is a sequence of identifiers separated by commas).
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
178
 
179
  ## Acknowledgments <a id="intro.ack">[[intro.ack]]</a>
180
 
181
  The C++ programming language as described in this document is based on
182
  the language as described in Chapter R (Reference Manual) of Stroustrup:
183
+ *The C++ Programming Language* (second edition, Addison-Wesley
184
+ Publishing Company, ISBN 0-201-53992-6, copyright ©1991 AT&T). That, in
185
+ turn, is based on the C programming language as described in Appendix A
186
+ of Kernighan and Ritchie: *The C Programming Language* (Prentice-Hall,
187
  1978, ISBN 0-13-110163-3, copyright ©1978 AT&T).
188
 
189
  Portions of the library Clauses of this document are based on work by
190
  P.J. Plauger, which was published as *The Draft Standard C++ Library*
191
  (Prentice-Hall, ISBN 0-13-117003-1, copyright ©1995 P.J. Plauger).
 
193
  POSIX® is a registered trademark of the Institute of Electrical and
194
  Electronic Engineers, Inc.
195
 
196
  ECMAScript® is a registered trademark of Ecma International.
197
 
198
+ Unicode® is a registered trademark of Unicode, Inc.
199
+
200
  All rights in these originals are reserved.
201
 
202
  <!-- Link reference definitions -->
 
 
 
 
 
 
 
203
  [basic.def.odr]: basic.md#basic.def.odr
 
204
  [basic.link]: basic.md#basic.link
 
205
  [basic.namespace]: dcl.md#basic.namespace
 
 
 
206
  [basic.types]: basic.md#basic.types
207
  [class.access]: class.md#class.access
208
+ [class.copy.assign]: class.md#class.copy.assign
209
+ [class.ctor]: class.md#class.ctor
 
 
210
  [class.derived]: class.md#class.derived
 
 
 
 
211
  [compliance]: library.md#compliance
212
+ [conv.lval]: expr.md#conv.lval
213
  [cpp]: cpp.md#cpp
 
214
  [cpp.replace]: cpp.md#cpp.replace
 
215
  [dcl.decl]: dcl.md#dcl.decl
216
  [dcl.fct]: dcl.md#dcl.fct
 
 
217
  [dcl.ptr]: dcl.md#dcl.ptr
218
  [dcl.ref]: dcl.md#dcl.ref
219
  [definitions]: library.md#definitions
 
220
  [defns.well.formed]: #defns.well.formed
221
  [depr]: future.md#depr
222
+ [depr.locale.stdcvt]: future.md#depr.locale.stdcvt
223
  [diff]: compatibility.md#diff
224
  [diff.library]: compatibility.md#diff.library
225
+ [expr.ass]: expr.md#expr.ass
226
  [expr.call]: expr.md#expr.call
 
 
227
  [expr.const]: expr.md#expr.const
228
+ [expr.post.incr]: expr.md#expr.post.incr
229
+ [expr.pre.incr]: expr.md#expr.pre.incr
 
 
230
  [expr.throw]: expr.md#expr.throw
231
  [gram]: grammar.md#gram
232
  [implimits]: limits.md#implimits
233
  [intro]: #intro
234
+ [intro.abstract]: #intro.abstract
235
  [intro.ack]: #intro.ack
236
  [intro.compliance]: #intro.compliance
237
  [intro.defs]: #intro.defs
238
+ [intro.execution]: basic.md#intro.execution
239
+ [intro.object]: basic.md#intro.object
 
 
 
 
240
  [intro.refs]: #intro.refs
241
  [intro.scope]: #intro.scope
242
  [intro.structure]: #intro.structure
 
243
  [lex]: lex.md#lex
244
  [lex.charset]: lex.md#lex.charset
245
  [lex.phases]: lex.md#lex.phases
246
  [library]: library.md#library
247
+ [stmt.block]: stmt.md#stmt.block
248
+ [support]: support.md#support
249
  [syntax]: #syntax
250
  [temp.arg]: temp.md#temp.arg
251
  [temp.deduct]: temp.md#temp.deduct
252
  [thread]: thread.md#thread
253
+ [using.headers]: library.md#using.headers
254
 
255
+ [^1]: With the qualifications noted in [[support]] through [[thread]]
256
+ and in [[diff.library]], the C standard library is a subset of the
257
+ C++ standard library.
258
 
259
  [^2]: “Correct execution” can include undefined behavior, depending on
260
+ the data being processed; see [[intro.defs]] and 
261
  [[intro.execution]].
262
 
263
  [^3]: This documentation also defines implementation-defined behavior;
264
+ see  [[intro.abstract]].
265
+
266
+ [^4]: This provision is sometimes called the “as-if” rule, because an
267
+ implementation is free to disregard any requirement of this document
268
+ as long as the result is *as if* the requirement had been obeyed, as
269
+ far as can be determined from the observable behavior of the
270
+ program. For instance, an actual implementation need not evaluate
271
+ part of an expression if it can deduce that its value is not used
272
+ and that no side effects affecting the observable behavior of the
273
+ program are produced.
274
+
275
+ [^5]: This documentation also includes conditionally-supported
 
 
 
 
 
 
 
276
  constructs and locale-specific behavior. See  [[intro.compliance]].