AaronBallman wrote:

> enums should be treated as 'int' types unless explicitly specified (C23) or 
> if 'int' would not be large enough to hold all the enumerated values. In the 
> latter case the compiler is free to choose a suitable integer that would hold 
> all such values.

In C23, the enumeration type is compatible with its underlying type, which is 
either `char` or a standard or extended signed or unsigned integer type (C23 The enumeration member type (C23 is specified by p12 
(when building the enumeration itself) and p15 and p16 (once the enumeration is 
complete). If there's no fixed underlying type, the members are compatible with 
either `int` or the enumerated type, and if there is a fixed underlying type, 
the members type is the enumerated type. Much of this is implementation-defined 
behavior. It sounds like our implementation was assuming compatibility with 
`char` and not `int` because of the aliasing behavior, and now you'd like to 
change it to be `int` so we don't have the aliasing problems?

cfe-commits mailing list

Reply via email to