This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC 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]

[Bug c/67314] No warning on assigning an out-of-range integer to an enum


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67314

--- Comment #2 from Chengnian Sun <chengniansun at gmail dot com> ---
(In reply to Andrew Pinski from comment #1)
> This warning is only useful for c++. C defines the full range of the
> underlying type of the enum for the enum while c++ has different rules. 
> 
> Also I think this warning would be too noisy for c code and clang is wrong
> to implement it for c.

Thanks for your reply. So in C, if I understand correctly, the enum construct
is mainly to define a set of integer constants. It is not like the enumerations
in other languages, such as Java, to define a set of categorical values.


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