title: why the c++ constructor was not called when it appear as the static member variable?
body: <p>I had a strange problem , </p>
  
  <p>declare a static member variable whose name is B class in A class . And initialize in the cpp file. but the constructor of B class was never called. I try to use some small test , the test constructor could be called normally. so it is very strange for our production system.</p>
  
  <p>The code like this , in <strong>hpp</strong>:</p>
  
  <pre><code>class Test
  {
      public:
      Test()
      {
          ofstream file("/tmp/wup.txt",ios::app);
          file &lt;&lt; "wup in test" &lt;&lt; endl;
          file.close();
      }
  };
  
  //## An extended personality
  class TsdNAExtPersonality : public TsdNAPersonality{
  public:
  
    TsdNAExtPersonality(
          s_gg62_personRec * gg62Header,
                     TsdNAFunctionType requiredFunctionType);
  private:
    static Test test;
  
  public:
    TsdNAExtPersonality( string * personalityFile, TsdNAFunctionType requiredFunctionType);
  };
  </code></pre>
  
  <p>And in another <strong>cpp</strong> file I initialize with </p>
  
  <pre><code>Test TsdNAExtPersonality::test;
  </code></pre>
  
  <p>I have tried in several way, but i found all of ways are unusefull.</p>
  
  <ol>
  <li>did not set the variable as member variable but as global variable ==> also can't output</li>
  <li>change the member variable as pointer and change the initialize way as using new ==> no </li>
  </ol>
  
  <p>the environment is HP-UX ,and the compile is aCC</p>
  
  <p>so my question are :</p>
  
  <ol>
  <li><p>is there any compile option will influence the variable ? in other words, all the static variable will not be initialized.</p></li>
  <li><p>from the standard of C++ it should be called when the library was load, right?</p></li>
  <li><p>I put another static int value using the same way, it could be initialized. but the class constructor is not called , very strange.</p></li>
  <li><p>is there any mistake in my code ?</p></li>
  </ol>