title: C++ Why does LLONG_MIN == -LLONG_MIN
body: <p>In C++ if I do this:</p>
  
  <pre><code>__int64 var = LLONG_MIN;
  __int64 var2 = -var;
  cout &lt;&lt; "var: "&lt;&lt; var &lt;&lt; endl;
  cout &lt;&lt; "var2: "&lt;&lt; var2 &lt;&lt; endl;
  </code></pre>
  
  <p>The output I get is:</p>
  
  <pre><code>var: -9223372036854775808
  var2: -9223372036854775808
  </code></pre>
  
  <p>What is the part of the standard that covers this? I assume it's signed integer overflow. This was compiled using g++ (GCC) 4.7.2.</p>
  
  <p>I have a subtract function and I'm writing an add function and I thought I could just do this:
  <code>add( someobj &amp;obj, long long num ) { subtract( obj, -num ); }</code>. I think that would work if it wasn't for LLONG_MIN.</p>