This is the mail archive of the gcc@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]

Re: Warning about int<-->enum conversions?


You Wrote Robert Dewar
> Giovanni Bajo wrote:
>
>> No, because this is a kind of integer promotion which is allowed by the
>> standard ([conv.prom]/2), so there is nothing wrong about it. Converting
>> the
>> other way (int -> enum) is instead forbidden and should be rejected by
>> GCC.
>
> But warnings are all *about* things that are allowed by the
> standard but are still suspicious. To me, it is a dubious
> design decision in the language to allow this promotion,
> and I definitely think that a warning would be useful.

For most C codes, it would be a real disaster.  C definitely
has a differrent view from Ada (and C programmers seem
to have a different view).  Turn that on warning and bootstrap
GCC's own source code, that will give you an idea ;-)

-- Gaby



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