title: C: unary minus operator behavior with unsigned operands
body: <p>I can't seem to find the relevant parts in the C standard fully defining the behavior of the unary minus operator with unsigned operands.</p>
  
  <p>The 2003 C++ standard (yes, C++, bear with me for a few lines) says in 5.3.1c7: <code>The negative of an unsigned quantity is computed by subtracting its value from 2^n, where n is the number of bits in the promoted operand.</code></p>
  
  <p>The 1999 C standard, however, doesn't include such an explicit statement and does not clearly define the unary - behavior neither in 6.5.3.3c1,3 nor in 6.5c4. In the latter it says <code>Some operators (the unary operator ~, and the binary operators &lt;&lt;, &gt;&gt;, &amp;, ^, and |, ...) ... return values that depend on the internal representations of integers, and have implementation-defined and undefined aspects for signed types.)</code>, which excludes the unary minus and things seem to remain vague.</p>
  
  <p><a href="https://stackoverflow.com/questions/1700713/unary-operator-result">This earlier question</a> refers to the K&amp;R ANSI C book, section A.7.4.5 that says <code>The negative of an unsigned quantity is computed by subtracting the promoted value from the largest value of the promoted type and adding one</code>.</p>
  
  <p>What would be the 1999 C standard equivalent to the above quote from the book?</p>
  
  <p>6.2.5c9 says: <code>A computation involving unsigned operands can never overflow, because a result that cannot be represented by the resulting unsigned integer type is reduced modulo the number that is one greater than the largest value that can be represented by the resulting type.</code></p>
  
  <p>Is that it? Or is there something else I'm missing?</p>