Do C++ signed types have modulo semantics?
Andrew Pinski
pinskia@physics.uc.edu
Tue Jun 28 14:05:00 GMT 2005
On Jun 28, 2005, at 9:58 AM, Gabriel Dos Reis wrote:
> Notice that in your rendition you're assuming that you can convert any
> unsigned value > INT_MAX to a int without invoking undefined behaviour.
If you read Nathan's mail correctly, the cast is implementation defined
and not undefined behavior so your argument does not work.
Quote from Nathan's mail (the emphases are not mine but Nathan's which
means he wanted
to you to read that part and not say it was undefined behavior):
> (provided we're on the standard 2's complement machine where the
> mapping between negative ints and unsigned is *implementation defined*
> to be the sane mapping, which I might point out you've already assumed
> in the wrap_sum I quoted).
-- Pinski
More information about the Gcc
mailing list