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: G++ enums 'underlying type'


> From: Gabriel Dos Reis <gdr@integrable-solutions.net>
> Paul Schlie <schlie@comcast.net> writes:
> 
> | Agreed, to clarify: an enumeration (enumerated type, i.e. enum)
> | representation need be no larger than the smallest compatible integer
> | type, which I believe was the question.  Enumerators, as you've noted
> | above are specified as int sized constants during an enumeration's
> | declaration, as it's unknown until the declaration is completed what
> | the range, therefore necessary size, of the enumeration and it's
> | correspondingly member representations need be.
> | 
> | We agree?
> 
> No.
> 
> Enumerators are for type ints in C.  They are of type enumeration in C++.
> 
> -- Gaby

No one asked about enumerators. The question was about the size of
enumerations (enumerated types, enums), which clearly need only be
sized as large as the smallest compatible integer type per the
standard, which isn't debatable.



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