question about an array of enum

Doug Gwyn gwyn at smoke.brl.mil
Fri Nov 9 18:09:54 AEST 1990


In article <1990Nov8.000847.16340 at athena.mit.edu> scs at adam.mit.edu (Steve Summit) writes:
>Does the standard really allow a different choice to be made for different
>enumerations?

Yes.  In fact it might be nice to allot only as large an integer type as is
needed to hold all valid values (enumeration constant values for the type).

Enumeration constants themselves are int, but who cares.  It's the type we
would like to be compact.

>If different enums can have different sizes (which seems like a
>useful license to grant the compiler) the documentation would
>have to state "the algorithm by which the integral types for
>enumerations are chosen," not "the [single] integral type."

Yes, I would think that the implementation definition should be expected
to spell out how the choice is made.



More information about the Comp.lang.c mailing list