Global variables in C ++ 11 with non-trivial constructors are built before being entered into main during the static initialization phase.
Similarly, non-functional local thread_local variables are created during the thread_local initialization phase on the thread.
Does the C ++ 11 standard indicate in which order these variables should be built? In both cases, if there are two variables:
Does the C ++ 11 standard indicate in which order they should be initialized, or that an error should be generated if the variable is used uninitialized?
Similarly for non-function-local thread_local:
Does the standard indicate the order that should be constructed, and does it determine what happens if the variable is used from the constructor of another before it is initialized?
Can you provide a standard C ++ 11 link in support of any statements you make to get an answer.
source share