incorrect enum warning?

Erik Trulsson ertr1013 at student.uu.se
Thu May 1 14:34:25 PDT 2003


On Thu, May 01, 2003 at 11:03:40PM +0200, Dag-Erling Smorgrav wrote:
> Stefan Farfeleder <stefan at fafoe.dyndns.org> writes:
> > Because 0x80000000 > INT_MAX on 32-Bit architectures, 0x80000000 has
> > type unsigned.  But enumeration constants always have type int, that's
> > why you're getting this warning.
> 
> but 0x80000000 == INT_MIN on 32-bit two's complement systems...

No. 0x80000000 has type unsigned int (assuming 32-bit int) and is thus
a large positive number.  INT_MIN has type signed int and is a negative
number.  The fact that they happen to have the same representation does
not mean they are the same thing.


-- 
<Insert your favourite quote here.>
Erik Trulsson
ertr1013 at student.uu.se


More information about the freebsd-hackers mailing list