From Jason Turner

[basic.start.dynamic]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpi0mt63mp/{from.md → to.md} +18 -18
tmp/tmpi0mt63mp/{from.md → to.md} RENAMED
@@ -1,26 +1,25 @@
1
- #### Dynamic initialization of non-local variables <a id="basic.start.dynamic">[[basic.start.dynamic]]</a>
2
 
3
- Dynamic initialization of a non-local 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*: An explicitly specialized non-inline static data member or
10
- variable template specialization has ordered
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-local variables `V` and `W` with static
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 [[basic.def.odr]] not
48
- caused directly or indirectly by the initialization of a non-local
49
- static or thread storage duration variable.
50
 
51
  It is *implementation-defined* whether the dynamic initialization of a
52
- non-local non-inline variable with static storage duration is sequenced
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. [^29] It is
57
- *implementation-defined* in which threads and at which points in the
58
- program such deferred dynamic initialization occurs.
59
 
60
- [*Note 3*: Such points should be chosen in a way that allows the
61
- programmer to avoid deadlocks. *end note*]
 
 
 
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-local 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-local 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-local variable with static or thread
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