title: C++ optimization of boolean or operator
body: <p>I have the following code which works as expected:</p>
  
  <pre><code>bool result=false;
  for(int i=0;i&lt;n;i++)
  {
      if(face[i].intersect(*coordinates, org, dir))
      {
          result = true;
      }
  }
  return result;
  </code></pre>
  
  <p>But this one has a different behavior (the value pointed to by <code>coordinates</code> is different)</p>
  
  <pre><code>bool result=false;
  for(int i=0;i&lt;n;i++)
  {
      result = result || faceList[i].intersect(*coordinates, org, dir, triangle);
  }
  return result;
  </code></pre>
  
  <p>What's the reason for this? Is the expression after <code>||</code> never evaluated if the one before is true? I thought this optimization was allowed only in an <code>if</code> statement.</p>