incorrect enum warning?

M. Warner Losh imp at bsdimp.com
Thu May 1 18:18:08 PDT 2003


In message: <20030501150713.GA34992 at madman.celabo.org>
            "Jacques A. Vidrine" <nectar at freebsd.org> writes:
: > when 0x80000000 is clearly within the range of 'int' on all platforms
: > we support?
: 
: Guessing:
: C does not specify one's complement or two's complement representation
: of integers.  On a one's complement 32-bit platform, 0x80000000 is -0
: (negative zero), which cannot be an `int'.

No.

The reason is that 0x800000000 is a positive number that's bigger than
MAX_INT (which is 0x7fffffff).  It isn't bigger than an unsigned int,
but it is larger than an int, but the standard doesn't say 'unsigned
int' it says 'int' which implies signed.

Warner



More information about the freebsd-hackers mailing list