title: OpenMP parallel for cout order
body: <p>I'm quite new to openmp and encounter such question.</p>
  
  <pre><code>#pragma omp parallel for
  for (int i = 0; i &lt; 10; ++i) {
      if (i == 0)
          for (int j = 0; j &lt; 100000000; ++j);   // Create a delay for i = 0.
      cout &lt;&lt; i &lt;&lt; flush;
  }
  </code></pre>
  
  <p>I expected <code>0</code> should be the last integer printed out since there's a delay. However, the actual output is in total random order.</p>
  
  <p>Is this caused by some kind of compiler optimization? Or do I misunderstood <code>parallel for</code>? </p>
  
  <p>I have version</p>
  
  <pre><code>#define _OPENMP 201307
  </code></pre>
  
  <p>Thanks.</p>