The C++98 language standard states: (My emphasis)
3.6.2 Initialization of nonlocal objects
£1 [...] Zeroinitialization and initialization with a constant expression are collectively called static initialization; all other initialization is dynamic initialization. [...]
£3 [...] It is implementationdefined whether or not the dynamic initialization (8.5, 9.4, 12.1, 12.6.1) of an object of namespace scope is done before the first statement of main. If the initialization is deferred to some point in time after the first statement of main, it shall occur before the first use of any function or object defined in the same translation unit as the object to be initialized. [...]
In my office, we have got two interpretations of the boldface passage...
My question is: There is a class has a whole bunch of static methods and dynamically initialized static data members. Can it (or can't it) happen that static methods in this class are called from another translation unit, before dynamic initialization has been completed?
Thanks!
[Edit:]
Perhaps this boils down to the reading of "it shall occur" as:
- Shall have begun
- Shall have been completed