title: How does c++ evaluate assignment operators (if statement)
body: <p>Consider the following</p>
  
  <pre><code>int main() {
      int a = 8;
      int b = 10;
  
      while (true) {
          if (a /= 2 &amp;&amp; b &lt; 12) {
              b++;
              std::cout &lt;&lt; b &lt;&lt; std::endl;
          }
          else break;
      }
  
      return 0;
  }
  </code></pre>
  
  <p>Now c++ is not my main language, but how does c++ evaluate this if statement?</p>
  
  <p>In this case, when <code>b&gt;=12</code>, the compiler throws the "division by zero" exception, but why?</p>
  
  <p>Now if i wrap the states in parentheses i do not get the exception. </p>
  
  <pre><code>if( (a /= 2) &amp;&amp; (b &lt; 12))
  </code></pre>
  
  <p>Does this have something to do with how c++ evaluates the statements? </p>
  
  <p>If evaluation is not the problem:</p>
  
  <p>I am aware of that</p>
  
  <pre><code>a = (a/2 &amp;&amp; b&lt;12)
  </code></pre>
  
  <p>would not hold either.</p>
  
  <p><code>P Λ Q</code> does not hold for <code>P Λ ¬Q</code> but the state of P should not be affected? Why is it <code>P</code> gets blamed instead of <code>¬Q</code>? </p>