On Saturday, 16 September 2017 at 03:06:24 UTC, Timothy Foster
wrote:
You are correct, however 6.7.2.2 "Enumeration specifiers"
states: "Each enumerated type shall be compatible with char, a
signed integer type, or an unsigned integer type. The choice of
type is implementation-defined, but shall be capable of
representing the values of all the members of the enumeration."
I believe that means that if you have the following:
enum ABC { A, B, C }
Then A, B, and C are by themselves ints, but the enum type ABC
can be a char if the compiler decides that's what it wants it
to be.
Oops, you're right. Then the situation must be the same as in
C++? If enum ABC is by itself a parameter of a function, the
argument will be int (and if it weren't, it would be promoted to
int anyway), but if the enum is a part of a structure, then it
can be anything...
At least, if enumerators themselves are ints, the enum type
probably won't be larger than an int... small consolation :)