Perhaps I should have emphasized more strongly that all globals should be declared in the file that contains main(), between the includes and the Main() entry point. In this way we have control over the initialization order.
Yes. But this has the restriction that you can't use these globals in another program without carrying main() along. So you have top make a copy and maintain duplicated code.
The globals do need to be in one place and it is not the file with main() in it. It is another .cpp file. These globals should be in an anonymous namespace accsssed by a Singleton object. That way you can reuse the globals in many programs.
On a broader note, globals are not good for these reasons:
1) local variable hides global variable
2) name conflicts. even within namespaces.
3) exposes implementation. No redesign
4) causes race conditions in multithreaded programs
5) expands ripple when value is screwed up. every function is a suspect
6) no guarantee the user will use the global
7) expands program footprint
8) memory for globals may be limited
9) no guarantee for the order of creation. Only the globals in a single file are crerated in the order of declaration. The total order is indeterminate. Hence, your global may no be there when you need it. Especially if a global object needs a global variable in another file in its constructor. aka: the initialization fiasco
10) expands ripple when a recode is needed. All the code using globals has to be changed. Bad if there is a large installed base.