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: Paolo Carlini <pcarlini@suse.de>
> 
> Paul Schlie wrote:
> 
>> 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.
>> 
> Actually, the question was rather different: which is the *actual*
> representation
> used by one specific implementation, that is the GNU C++ compiler? I know
> what the standard says in general about this, but, having noticed that
> even for an
> empty enum the underlying type appear to be 4-bytes wide, I wondered whether
> smaller underlying types are ever used in our implementation...
> 
> ... but, it's not a big deal: we have got more serious issues ;)

Understood, but regardless of whether or not GCC presently optimally
sizes enums, it's likely a good idea to assume at it does, or risk
complicating it's subsequent refinement to do so.



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