title: C++ - Non-local static object vs local static object
body: <p>Regarding the book "Effective C++" from Scot Meyers, and the 4th item: non-local static objects can be uninitialized before the are used (static in this case means "global", with static life). If you replace it with a local-<code>static</code> object, which is created inside a function that returns a reference to it, the object is then for sure initialized before use.</p>
  
  <p>I always have a file with constants. I declare <code>extern const int a;</code> in an .hpp file and define it in the .cpp file. But can then the same thing happen? <code>a</code> can be uninitialized. Or not? Does the same rule apply for built-in types?</p>