tmp/tmptje_zw2h/{from.md → to.md}
RENAMED
|
@@ -1,32 +1,23 @@
|
|
| 1 |
-
### Static initialization <a id="basic.start.static">[[basic.start.static]]</a>
|
| 2 |
|
| 3 |
Variables with static storage duration are initialized as a consequence
|
| 4 |
of program initiation. Variables with thread storage duration are
|
| 5 |
initialized as a consequence of thread execution. Within each of these
|
| 6 |
phases of initiation, initialization occurs as follows.
|
| 7 |
|
| 8 |
-
A *constant initializer* for a variable or temporary object `o` is an
|
| 9 |
-
initializer whose full-expression is a constant expression, except that
|
| 10 |
-
if `o` is an object, such an initializer may also invoke constexpr
|
| 11 |
-
constructors for `o` and its subobjects even if those objects are of
|
| 12 |
-
non-literal class types.
|
| 13 |
-
|
| 14 |
-
[*Note 1*: Such a class may have a non-trivial
|
| 15 |
-
destructor. — *end note*]
|
| 16 |
-
|
| 17 |
*Constant initialization* is performed if a variable or temporary object
|
| 18 |
-
with static or thread storage duration is
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
initialization*. All static initialization strongly happens before
|
| 25 |
-
[[intro.races]]
|
| 26 |
|
| 27 |
-
[*Note
|
| 28 |
described in [[basic.start.dynamic]]; that of local static variables is
|
| 29 |
described in [[stmt.dcl]]. — *end note*]
|
| 30 |
|
| 31 |
An implementation is permitted to perform the initialization of a
|
| 32 |
variable with static or thread storage duration as a static
|
|
@@ -39,11 +30,11 @@ statically, provided that
|
|
| 39 |
- the static version of the initialization produces the same value in
|
| 40 |
the initialized variable as would be produced by the dynamic
|
| 41 |
initialization if all variables not required to be initialized
|
| 42 |
statically were initialized dynamically.
|
| 43 |
|
| 44 |
-
[*Note
|
| 45 |
|
| 46 |
As a consequence, if the initialization of an object `obj1` refers to an
|
| 47 |
object `obj2` of namespace scope potentially requiring dynamic
|
| 48 |
initialization and defined later in the same translation unit, it is
|
| 49 |
unspecified whether the value of `obj2` used will be the value of the
|
|
|
|
| 1 |
+
#### Static initialization <a id="basic.start.static">[[basic.start.static]]</a>
|
| 2 |
|
| 3 |
Variables with static storage duration are initialized as a consequence
|
| 4 |
of program initiation. Variables with thread storage duration are
|
| 5 |
initialized as a consequence of thread execution. Within each of these
|
| 6 |
phases of initiation, initialization occurs as follows.
|
| 7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
*Constant initialization* is performed if a variable or temporary object
|
| 9 |
+
with static or thread storage duration is constant-initialized
|
| 10 |
+
[[expr.const]]. If constant initialization is not performed, a variable
|
| 11 |
+
with static storage duration [[basic.stc.static]] or thread storage
|
| 12 |
+
duration [[basic.stc.thread]] is zero-initialized [[dcl.init]].
|
| 13 |
+
Together, zero-initialization and constant initialization are called
|
| 14 |
+
*static initialization*; all other initialization is *dynamic
|
| 15 |
+
initialization*. All static initialization strongly happens before
|
| 16 |
+
[[intro.races]] any dynamic initialization.
|
| 17 |
|
| 18 |
+
[*Note 1*: The dynamic initialization of non-local variables is
|
| 19 |
described in [[basic.start.dynamic]]; that of local static variables is
|
| 20 |
described in [[stmt.dcl]]. — *end note*]
|
| 21 |
|
| 22 |
An implementation is permitted to perform the initialization of a
|
| 23 |
variable with static or thread storage duration as a static
|
|
|
|
| 30 |
- the static version of the initialization produces the same value in
|
| 31 |
the initialized variable as would be produced by the dynamic
|
| 32 |
initialization if all variables not required to be initialized
|
| 33 |
statically were initialized dynamically.
|
| 34 |
|
| 35 |
+
[*Note 2*:
|
| 36 |
|
| 37 |
As a consequence, if the initialization of an object `obj1` refers to an
|
| 38 |
object `obj2` of namespace scope potentially requiring dynamic
|
| 39 |
initialization and defined later in the same translation unit, it is
|
| 40 |
unspecified whether the value of `obj2` used will be the value of the
|