Within one translation unit, global variables are initialized in several stages:
First, all variables that have "static initialization" are initialized in their order of declaration (see below).
Then, all "ordered dynamic initializations" are performed, again in their order of declaration.
There are also "unordered dynamic initializations", which are "unsequenced" with respect to the other dynamic initializations (but always after the static ones).
Destruction of statically and ordered-dynamically initialized globals proceeds in opposite order (and the unordered ones again "unsequenced", but before the static ones). The relative initialization ordering across TUs is unspecified.
To explain the terminology loosely: a global variable is "statically initialized" if it is either initialized to a constant (for constructor calls, this requires constexpr
constructors), or if it is has no initializer and is declared static
(which makes it zero-initialized): static int a; Foo b(1, true, Blue);
On the other hand, if the initializer is not anything "constant", like a function call or a non-constexpr constructor, then the object is "dynamically initialized". Most ordinary globals that are dynamically initialized are "ordered"; the only "unordered" ones are static members of template specializations and such like.
(Note that all this got a lot more detailed in C++11, as there is now explicit attention to thread-local storage and initialization at the start of a thread.)