http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#Static_and_Global_Variables
Static or global variables of class type are forbidden: they cause
hard-to-find bugs due to indeterminate order of construction and
destruction.
If a global variable of class type doesn’t lean on other global variables, such as std::string strvar("abc"), what’s wrong/unsafe to use it?
The guide also said:
…in addition to banning globals of class type, we do not
allow static POD variables to be initialized with the result of a
function, unless that function (such as getenv(), or getpid()) does
not itself depend on any other globals.
I think strvar is fine for the same reason: its constructor doesn’t itself depend on any other globals.
Also I wonder if C++11’s looser definition of POD has any reflection in this regard?
Google is apparently trying to keep the rules simple. So while there may be some cases where it’s pretty safe, describing those exceptions would have been difficult. And the benefits of allowing these exceptions is probably not great enough to warrant this extra complexity.