title: static initialization order fiasco
body: <p>I was reading about SIOF from a book and it gave an example :  </p>
  
  <pre><code>//file1.cpp
  extern int y;
  int x=y+1;
  
  //file2.cpp
  extern int x;
  int y=x+1;  
  </code></pre>
  
  <p>Now My question is :<br>
  In above code, will following things happen ?  </p>
  
  <ol>
  <li>while compiling file1.cpp, compiler leaves y as it is i.e doesn't allocate storage for it.  </li>
  <li>compiler allocates storage for x, but doesn't initialize it.  </li>
  <li>While compiling file2.cpp, compiler leaves x as it is i.e doesn't allocate storage for it.  </li>
  <li>compiler allocates storage for y, but doesn't initialize it.  </li>
  <li>While linking file1.o and file2.o, now let file2.o is initialized first, so now:<br>
  Does x gets initial value of 0? or doesn't get initialized?</li>
  </ol>