title: A weird question for Tmax(0x7fffffff), why (!x) == x?
body: <pre><code>#include &lt;stdio.h&gt;
  void show_case(int x) {
      printf(&quot;x + x + 2 = %d\n&quot;, x + x + 2);
      printf(&quot;!(x + x + 2) = %d\n&quot;, !(x + x + 2));
  }
  int main(){
      show_case(-1);  // the output is 0 &amp; 1
      show_case(0x7fffffff); // the output is 0 &amp; 0;
      return 0;
  }
  </code></pre>
  <p>hi friends, recently I come across a very weird question when dealing with the datalab in cmu15213.</p>
  <p>I simplified the question into the code above.</p>
  <p>As we can see, I have implemented a show_case function which can show the (x + x + 2) and !(x + x + 2);
  when the argument is -1, the result is as we expected, x+x+2 = 0 and !(x+x+2) = 1.</p>
  <p>But when I turn to 0x7fffffff, I found that x+x+2 = 0 and !(x + x + 2) = 0 which is really weird for me.</p>
  <p>(Note : the code above was ran on my Ubuntu virtual Machine, while in my windows visual studio, it turns out the ans for 0x7fffffff is 0 &amp; 1 which is as expected).
  <a href="https://i.stack.imgur.com/iHOKm.jpg" rel="nofollow noreferrer">enter image description here</a></p>