File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -2167,11 +2167,14 @@ void func(int x)
2167
2167
2168
2168
$(H3 $(LEGACY_LNAME2 Local Static Variables, local-static-variables, Local Static Variables))
2169
2169
2170
- $(P Local variables in functions can be declared as static
2171
- or $(D __gshared) in which case they are statically allocated
2172
- rather than being allocated on the stack.
2173
- As such, their value persists beyond the exit of the function.
2174
- )
2170
+ $(P Local variables in functions declared as `static`, `shared static`
2171
+ or $(D __gshared) are statically allocated
2172
+ rather than being allocated on the stack.
2173
+ The lifetime of `__gshared` and `shared static` variables begins
2174
+ when the function is first executed and ends when the program ends.
2175
+ The lifetime of `static` variables begins when the function is first
2176
+ executed within the thread and ends when that thread terminates.
2177
+ )
2175
2178
2176
2179
$(SPEC_RUNNABLE_EXAMPLE_COMPILE
2177
2180
---
@@ -2185,8 +2188,7 @@ void foo()
2185
2188
)
2186
2189
2187
2190
$(P The initializer for a static variable must be evaluatable at
2188
- compile time, and they are initialized upon the start of the thread
2189
- (or the start of the program for $(D __gshared)).
2191
+ compile time.
2190
2192
There are no static constructors or static destructors
2191
2193
for static local variables.
2192
2194
)
You can’t perform that action at this time.
0 commit comments