<div class="gmail_quote">On Fri, Apr 13, 2012 at 14:29, Dave Goodell <span dir="ltr"><<a href="mailto:goodell@mcs.anl.gov">goodell@mcs.anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On Apr 13, 2012, at 7:58 AM CDT, Jed Brown wrote:<br>
<br>
> unary - is applied to an unsigned type, producing an unsigned result. The actual value is implementation defined, but most/all compilers on twos complement systems will insert a normal signed negation instruction (NEG on Intel).<br>
<br>
</div>I don't disagree with most of your analysis, but isn't the unsigned result well defined by other parts of the standard? Doesn't it have to be done in terms of modulo arithmetic (irrespective of whether 2's complement, 1's complement, or sign and magnitude representations are used)? So the resulting unsigned value of "-(size_t)4" has to be "SIZE_MAX+1-4", right?<br>
<br>
Relevant C/C++ standards sections and similar rationale here: <a href="http://stackoverflow.com/a/1269049/158513" target="_blank">http://stackoverflow.com/a/1269049/158513</a></blockquote><div><br></div><div>Thanks for pointing this out.</div>
</div>