title: Short circuit evaluation and side effects
body: <p>OK, I'm a little embarassed to ask this question, but I just want to be sure...</p>
  
  <p>It is known that C uses short circuit evaluation in boolean expressions:</p>
  
  <pre><code>int c = 0;
  if (c &amp;&amp; func(c)) { /* whatever... */ }
  </code></pre>
  
  <p>In that example <code>func(c)</code> is not called because <code>c</code> evaluates to <code>0</code>. But how about more sophisticated example where side effects of comparison would change the variable being compared next? Like this:</p>
  
  <pre><code>int c; /* this is not even initialized... */
  if (canInitWithSomeValue(&amp;c) &amp;&amp; c == SOMETHING) { /*...*/ }
  </code></pre>
  
  <p>Function <code>canInitWithSomeValue</code> returns true and changes value at given pointer in case of success. Is it guaranteed that subsequent comparisons (<code>c == SOMETHING</code> in this example) uses value set by <code>canInitWithSomeValue(&amp;c)</code>?</p>
  
  <p>No matter how heavy optimizations the compiler uses?</p>