title: When is constructor called for a static object
body: <p>I understand that static variables are initialized at compile time, but what about a static object?</p>
  
  <p>e.g. if I have the following code:</p>
  
  <pre><code>class A {
      A();
  };
  
  A::A(){
      std::cout &lt;&lt; "Constructing A" &lt;&lt; std::endl;
  }
  
  int main(){
      std::cout &lt;&lt; "Hello World!" &lt;&lt; std::endl;
      static A A_obj;
      std::cout &lt;&lt; "Goodbye cruel world" &lt;&lt; std::endl;
      return 0;
  }
  </code></pre>
  
  <p>Should I expect the output to be:</p>
  
  <pre><code>Hello World!
  Constructing A
  Goodbye cruel world
  </code></pre>
  
  <p>or</p>
  
  <pre><code>Constructing A
  Hello World!
  Goodbye cruel world
  </code></pre>