tmp/tmpi0mt63mp/{from.md → to.md}
RENAMED
|
@@ -1,26 +1,25 @@
|
|
| 1 |
-
#### Dynamic initialization of non-
|
| 2 |
|
| 3 |
-
Dynamic initialization of a non-
|
| 4 |
duration is unordered if the variable is an implicitly or explicitly
|
| 5 |
instantiated specialization, is partially-ordered if the variable is an
|
| 6 |
inline variable that is not an implicitly or explicitly instantiated
|
| 7 |
specialization, and otherwise is ordered.
|
| 8 |
|
| 9 |
-
[*Note 1*:
|
| 10 |
-
|
| 11 |
-
initialization. — *end note*]
|
| 12 |
|
| 13 |
A declaration `D` is *appearance-ordered* before a declaration `E` if
|
| 14 |
|
| 15 |
- `D` appears in the same translation unit as `E`, or
|
| 16 |
- the translation unit containing `E` has an interface dependency on the
|
| 17 |
translation unit containing `D`,
|
| 18 |
|
| 19 |
in either case prior to `E`.
|
| 20 |
|
| 21 |
-
Dynamic initialization of non-
|
| 22 |
storage duration are ordered as follows:
|
| 23 |
|
| 24 |
- If `V` and `W` have ordered initialization and the definition of `V`
|
| 25 |
is appearance-ordered before the definition of `W`, or if `V` has
|
| 26 |
partially-ordered initialization, `W` does not have unordered
|
|
@@ -42,25 +41,26 @@ storage duration are ordered as follows:
|
|
| 42 |
sequenced.
|
| 43 |
|
| 44 |
[*Note 2*: This definition permits initialization of a sequence of
|
| 45 |
ordered variables concurrently with another sequence. — *end note*]
|
| 46 |
|
| 47 |
-
A *non-initialization odr-use* is an odr-use [[
|
| 48 |
-
|
| 49 |
-
|
| 50 |
|
| 51 |
It is *implementation-defined* whether the dynamic initialization of a
|
| 52 |
-
non-
|
| 53 |
before the first statement of `main` or is deferred. If it is deferred,
|
| 54 |
it strongly happens before any non-initialization odr-use of any
|
| 55 |
non-inline function or non-inline variable defined in the same
|
| 56 |
-
translation unit as the variable to be initialized.
|
| 57 |
-
*implementation-defined* in which threads and at which points in the
|
| 58 |
-
program such deferred dynamic initialization occurs.
|
| 59 |
|
| 60 |
-
|
| 61 |
-
|
|
|
|
|
|
|
|
|
|
| 62 |
|
| 63 |
[*Example 1*:
|
| 64 |
|
| 65 |
``` cpp
|
| 66 |
// - File 1 -
|
|
@@ -97,25 +97,25 @@ point after the first statement of `main`, `b` will be initialized prior
|
|
| 97 |
to its use in `A::A`.
|
| 98 |
|
| 99 |
— *end example*]
|
| 100 |
|
| 101 |
It is *implementation-defined* whether the dynamic initialization of a
|
| 102 |
-
non-
|
| 103 |
before the first statement of `main` or is deferred. If it is deferred,
|
| 104 |
it strongly happens before any non-initialization odr-use of that
|
| 105 |
variable. It is *implementation-defined* in which threads and at which
|
| 106 |
points in the program such deferred dynamic initialization occurs.
|
| 107 |
|
| 108 |
It is *implementation-defined* whether the dynamic initialization of a
|
| 109 |
-
non-
|
| 110 |
before the first statement of the initial function of a thread or is
|
| 111 |
deferred. If it is deferred, the initialization associated with the
|
| 112 |
entity for thread *t* is sequenced before the first non-initialization
|
| 113 |
odr-use by *t* of any non-inline variable with thread storage duration
|
| 114 |
defined in the same translation unit as the variable to be initialized.
|
| 115 |
It is *implementation-defined* in which threads and at which points in
|
| 116 |
the program such deferred dynamic initialization occurs.
|
| 117 |
|
| 118 |
-
If the initialization of a non-
|
| 119 |
storage duration exits via an exception, the function `std::terminate`
|
| 120 |
is called [[except.terminate]].
|
| 121 |
|
|
|
|
| 1 |
+
#### Dynamic initialization of non-block variables <a id="basic.start.dynamic">[[basic.start.dynamic]]</a>
|
| 2 |
|
| 3 |
+
Dynamic initialization of a non-block variable with static storage
|
| 4 |
duration is unordered if the variable is an implicitly or explicitly
|
| 5 |
instantiated specialization, is partially-ordered if the variable is an
|
| 6 |
inline variable that is not an implicitly or explicitly instantiated
|
| 7 |
specialization, and otherwise is ordered.
|
| 8 |
|
| 9 |
+
[*Note 1*: A non-inline explicit specialization of a templated variable
|
| 10 |
+
has ordered initialization. — *end note*]
|
|
|
|
| 11 |
|
| 12 |
A declaration `D` is *appearance-ordered* before a declaration `E` if
|
| 13 |
|
| 14 |
- `D` appears in the same translation unit as `E`, or
|
| 15 |
- the translation unit containing `E` has an interface dependency on the
|
| 16 |
translation unit containing `D`,
|
| 17 |
|
| 18 |
in either case prior to `E`.
|
| 19 |
|
| 20 |
+
Dynamic initialization of non-block variables `V` and `W` with static
|
| 21 |
storage duration are ordered as follows:
|
| 22 |
|
| 23 |
- If `V` and `W` have ordered initialization and the definition of `V`
|
| 24 |
is appearance-ordered before the definition of `W`, or if `V` has
|
| 25 |
partially-ordered initialization, `W` does not have unordered
|
|
|
|
| 41 |
sequenced.
|
| 42 |
|
| 43 |
[*Note 2*: This definition permits initialization of a sequence of
|
| 44 |
ordered variables concurrently with another sequence. — *end note*]
|
| 45 |
|
| 46 |
+
A *non-initialization odr-use* is an odr-use [[term.odr.use]] not caused
|
| 47 |
+
directly or indirectly by the initialization of a non-block static or
|
| 48 |
+
thread storage duration variable.
|
| 49 |
|
| 50 |
It is *implementation-defined* whether the dynamic initialization of a
|
| 51 |
+
non-block non-inline variable with static storage duration is sequenced
|
| 52 |
before the first statement of `main` or is deferred. If it is deferred,
|
| 53 |
it strongly happens before any non-initialization odr-use of any
|
| 54 |
non-inline function or non-inline variable defined in the same
|
| 55 |
+
translation unit as the variable to be initialized.[^25]
|
|
|
|
|
|
|
| 56 |
|
| 57 |
+
It is *implementation-defined* in which threads and at which points in
|
| 58 |
+
the program such deferred dynamic initialization occurs.
|
| 59 |
+
|
| 60 |
+
*Recommended practice:* An implementation should choose such points in a
|
| 61 |
+
way that allows the programmer to avoid deadlocks.
|
| 62 |
|
| 63 |
[*Example 1*:
|
| 64 |
|
| 65 |
``` cpp
|
| 66 |
// - File 1 -
|
|
|
|
| 97 |
to its use in `A::A`.
|
| 98 |
|
| 99 |
— *end example*]
|
| 100 |
|
| 101 |
It is *implementation-defined* whether the dynamic initialization of a
|
| 102 |
+
non-block inline variable with static storage duration is sequenced
|
| 103 |
before the first statement of `main` or is deferred. If it is deferred,
|
| 104 |
it strongly happens before any non-initialization odr-use of that
|
| 105 |
variable. It is *implementation-defined* in which threads and at which
|
| 106 |
points in the program such deferred dynamic initialization occurs.
|
| 107 |
|
| 108 |
It is *implementation-defined* whether the dynamic initialization of a
|
| 109 |
+
non-block non-inline variable with thread storage duration is sequenced
|
| 110 |
before the first statement of the initial function of a thread or is
|
| 111 |
deferred. If it is deferred, the initialization associated with the
|
| 112 |
entity for thread *t* is sequenced before the first non-initialization
|
| 113 |
odr-use by *t* of any non-inline variable with thread storage duration
|
| 114 |
defined in the same translation unit as the variable to be initialized.
|
| 115 |
It is *implementation-defined* in which threads and at which points in
|
| 116 |
the program such deferred dynamic initialization occurs.
|
| 117 |
|
| 118 |
+
If the initialization of a non-block variable with static or thread
|
| 119 |
storage duration exits via an exception, the function `std::terminate`
|
| 120 |
is called [[except.terminate]].
|
| 121 |
|