[basic.start.dynamic] (original) (raw)

:

#include "a.h" #include "b.h" B b; A::A(){ b.Use(); }

#include "a.h" A a;

#include "a.h" #include "b.h" extern A a; extern B b;

int main() { a.Use(); b.Use(); }

It is implementation-defined whether either a or b is initialized before main is entered or whether the initializations are delayed until a is first odr-used inmain.

In particular, if a is initialized beforemain is entered, it is not guaranteed that b will be initialized before it is odr-used by the initialization of a, that is, before A​::​A is called.

If, however, a is initialized at some point after the first statement of main, b will be initialized prior to its use in A​::​A.

end example