This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFC: Warning fixes


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."


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]