FW: [casting; overflow detection]

Robert Elz kre at munnari.OZ.AU
Sat Jan 15 09:28:17 UTC 2011


    Date:        Sat, 15 Jan 2011 00:02:34 -0800
    From:        Paul Eggert <eggert at cs.ucla.edu>
    Message-ID:  <4D31549A.7060402 at cs.ucla.edu>

  | Well, I'm afraid that's not true these days.  With the latest GCC on x86,

That's only because gcc is taking advantage of what the C standards
people say is OK - it isn't because i386's can't, or doesn't, do "normal"
32 (or 64) bit 2's complement arithmetic (just as easily, or more easily
than anything else).    And that behaviour can be disabled (and IMO,
should be ...)

In practice the optimisation is useless - the code it makes go away wouldn't
have been written in the first place if it wasn't important, so when it
happens it just makes us programmers work harder to prevent the compiler
from taking useless advantage.

kre



More information about the tz mailing list