title: Will (global) static variables be destroyed at program end?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/2204608/does-c-call-destructors-for-global-and-class-static-variables">Does C++ call destructors for global and class static variables?</a>  </p>
  </blockquote>
  
  
  
  <p>What is the lifetime of</p>
  
  <ul>
  <li>global <code>MyClass myclass;</code></li>
  <li>global <code>static MyClass myclass;</code></li>
  <li>global <code>const MyClass myclass;</code></li>
  <li>global <code>static const MyClass myclass;</code></li>
  <li>function local <code>static MyClass myclass;</code> when its initialization actually occured</li>
  <li>global <code>static constexpr MyClass myclass;</code> in C++11</li>
  </ul>
  
  <p>and especially <strong>will they be destroyed on regular program end</strong> (i.e. <code>main</code> is left without an error)? Where does the standard states so.</p>
  
  <p>I noticed that a <em>private destructor</em> prevents the creation of all those variables. But if I remember correctly it was explicitly mentioned somewhere that some static data may be put into a static data section and loaded pre-constructed, already. This would imply for me that no destructor would be called. And this would imply I am allowed to define such a variable...</p>