title: Singleton instance declared as static variable of GetInstance method, is it thread-safe?
body: <p>I've seen implementations of Singleton patterns where instance variable was declared as static variable in GetInstance method. Like this:</p>
  
  <pre><code>SomeBaseClass &amp;SomeClass::GetInstance()
  {
     static SomeClass instance;
     return instance;
  }
  </code></pre>
  
  <p>I see following positive sides of this approach:</p>
  
  <ul>
  <li>The code is simpler, because it's compiler who responsible for creating this object only when GetInstance called for the first time.</li>
  <li>The code is safer, because there is no other way to get reference to instance, but with GetInstance method and there is no other way to change instance, but inside GetInstance method.</li>
  </ul>
  
  <p>What are the negative sides of this approach (except that this is not very OOP-ish) ? Is this thread-safe?</p>