Vladimir Simonov <sv@xxxxx> writes: > 1. "However, GNU C++ allows users to control the order of initialization of objects > defined at namespace scope with the `init_priority' attribute by > specifying a relative PRIORITY". Because no "in a given translation > unit" here does it mean that > init_priority works over all translation units and has "link unit" scope? Yes. > 2. If 1 is true what about anonymous namespace? Is it considered the same namespace > for different translation units? I'm not sure what you mean here. init_priority is a global value. All objects with higher priority are constructed before all objects with lower priority. This is true whether the objects are defined at global scope, in a named namespace, or in an anonymous namespace. > 3. "Note that the particular values of PRIORITY do not matter; only > their relative ordering." IMO it may be correct only if default > priority value > 65535. > But it means that init priority can't be set lover(value greater) then default. > Is it correct? All objects with an init_priority attribute are constructed before any object with no init_priority attribute. Note that although the documentation doesn't seem to mention it, the init_priority attribute only works correctly when using the GNU linker or gold. As far as I know no other linker implements it. So you're fine on GNU/Linux, but on other operating systems you should confirm that it works. Ian