RFC: Warning fixes

Andreas Schwab schwab@suse.de
Thu Dec 28 23:08:00 GMT 2006


Mark Kettenis <mark.kettenis@xs4all.nl> writes:

> ISO C clearly states that enumeration constants have type 'int', so
> sig could be negative, and we defenitely want to catch that case.  If
> GCC thinks it knows that (sig >= TARGET_SIGNAL_FIRST), I think it is
> being too smart for its own good.

The compiler can chose any signed or unsigned type for the enumeration
_type_ to be compatible with, provided that the type can represent all
members of it.  So it is perfectly valid for the compiler to chose an
unsigned type for an emumeration that only consists of non-negative
values.  This is independent of the type of the enum constants itself.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."



More information about the Gdb-patches mailing list