title: What makes a static variable initialize only once?
body: <p>I noticed that if you initialize a static variable in C++ in code, the initialization only runs the first time you run the function.</p>
  
  <p>That is cool, but how is that implemented?  Does it translate to some kind of twisted if statement? (if given a value, then ..)</p>
  
  <pre><code>void go( int x )
  {
      static int j = x ;
      cout &lt;&lt; ++j &lt;&lt; endl ; // see 6, 7, 8
  } 
  
  int main()
  {
      go( 5 ) ;
      go( 5 ) ;
      go( 5 ) ; 
  }
  </code></pre>