-
Notifications
You must be signed in to change notification settings - Fork 7
Description
Full name of submitter: Brian Bi
Issue description: It is heavily implied, but not stated outright, that initialization of all non-local static variables happens before initialization of all non-local thread-local variables. For example, [basic.start.static] seems to refer to initializing variables with static storage duration and thread storage duration as "phases", which may imply that one phase completes before the other starts. [basic.start.term]/2 appears to guarantee that returning from main
destroys all thread-local variables of the main thread before destroying any static variables, which would be peculiar if the static variables were not initialized first.
Suggested resolution: Edit [basic.start.static]/1 as shown:
Variables with static storage duration are initialized as a consequence of program initiation. Variables with thread storage duration are initialized as a consequence of thread execution. The initialization of all non-block variables with static storage duration (if any) strongly happens before the initialization of any non-block variable with thread storage duration. Within each of these phases of initiation, initialization occurs as follows.