title: C++ static global non-POD: theory and practice
body: <p>I was reading the Qt coding conventions docs and came upon the following paragraph:</p>
  
  <blockquote>
    <p>Anything that has a constructor or needs to run code to be initialized cannot be used as global object in library code, since it is undefined when that constructor/code will be run (on first usage, on library load, before main() or <strong>not at all</strong>). Even if the execution time of the initializer is defined for shared libraries, you’ll get into trouble when moving that code in a plugin or if the library is compiled statically.</p>
  </blockquote>
  
  <p>I know what the <a href="https://stackoverflow.com/questions/1421671/when-are-static-c-class-members-initialized">theory</a> says, but I don't understand the "not at all" part. Sometimes I use non-POD global const statics (e.g: QString) and it never occured to me that they might not be initialized... Is this specific to shared objects / DLLs? Does this happen for broken compilers only?   </p>
  
  <p>What do you think about this rule? </p>