You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
voidfun(){
staticint value = 0;
}
intmain(){
fun(); // in main thread/* fun(); assume in a different thread*//* fun(); assume in a different thread*/
}
we lack the specification for the (block) variable with static storage duration in a similar manner as [class.static.data] p1 did for the static data member. The approach of [class.static.data] p1 is that:
If a static data member is declared thread_local there is one copy of the member per thread. If a static data member is not declared thread_local there is one copy of the data member that is shared by all the objects of the class.
The second sentence can imply that we only have one concrete object or reference associated with the static data member regardless of how many threads refers to it.
Don't we need a similar rule for other kinds of variables with static storage duration, non-normative, such as the following:
There is only one object or reference associated with the variable with static storage duration at any time.
The text was updated successfully, but these errors were encountered:
Yes, we need a conceptual divorce between variable / data member (that appears in source code) and which object it denotes, which might be one (static non-thread_local), one per thread (thread_local), or one per function invocation (non-static local variable).
we lack the specification for the (block) variable with static storage duration in a similar manner as [class.static.data] p1 did for the static data member. The approach of [class.static.data] p1 is that:
The second sentence can imply that we only have one concrete
object or reference
associated with the static data member regardless of how many threads refers to it.Don't we need a similar rule for other kinds of variables with static storage duration, non-normative, such as the following:
The text was updated successfully, but these errors were encountered: