title: Program compiled by gcc runs faster than compiled by g++
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/3302657/performance-difference-between-gcc-and-g-for-c-program">Performance difference between gcc and g++ for C program</a>  </p>
  </blockquote>
  
  
  
  <p>I was checking the improvement of performance with using register storage specifier for the loop control variable when I accidentally noticed that program compiled with gcc runs faster than compiled with g++. Can someone explain it to me?</p>
  
  <p>Here is the code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  const unsigned long scope = 1000000000;
  
  int main()
  {
      register unsigned long i;
      for (i=0; i &lt; scope; i++);
      return 0;
  }
  </code></pre>
  
  <p>;</p>
  
  <pre><code>gcc register.c
  time ./a.out   
  real    0m0.466s
  user    0m0.468s
  sys     0m0.000s
  
  g++ register.c
  time ./a.out 
  real    0m0.923s
  user    0m0.920s
  sys     0m0.000s
  </code></pre>