How an 'if (A && B)' statement is evaluated?
<pre><code>if( (A) &amp;&amp; (B) )
{
  //do something
}
else
  //do something else
</code></pre>

<p>The question is, would the statement immediately break to else if A was FALSE.  Would B even get evaluated?  </p>

<p>I ask this in the case that B checking the validity of an array index say array[0] when the array is actually empty and has zero elements.  Therefore throwing a segfault because we are trying to access something that is out of bounds of the array.  Specifically</p>

<pre><code>if( (array.GetElements() &gt; 0) &amp;&amp; (array[0]))
  array[0]-&gt;doSomething();
else
  //do nothing and return
</code></pre>

<p>This may be dangerous if array[0] actually gets evaluated because it segfaults without the first check to the left of the '&amp;&amp;'.  Precedence tells me that the left side will definitely take precedence but it doesn't tell me that it won't evaluate the right side if the left is FALSE.</p>
