Hi Peter,
Do static objects of class scope belong to the objects of namespace scope?
I thought so at first (class can be considered as a namespace from my point of view), but then I did a little bit of searching and found that “namespace scope” != “class scope”. In the C++98 working draft basic concepts I found nothing about class static variables initialization order. In the C++09 working draft (see section 3.6.2) there is written initialization order type only of static variables of template classes, but nothing about “normal” classes. So it appears to me that the initialization order of static class variables is unspecified (unordered?). But maybe I’m just looking on the wrong place and it’s still specified somewhere or I’ve misunderstood something…
And I assume that 1. and 2. are initialized throughout the whole binary, not individual translation units only. right?
Right.
Do you mean not to use static members in tests? You actually already suggested before that we initialize complex objects in the Test class ctor - that seems like the only solution.
Well, if we don’t want to restrict our classes to use only intrinsic/primitive types, then initializing complex objects in the Test class ctor seems to me as the only solution, too.
Good night,
Petr
