This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: G++ enums 'underlying type'
- From: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- To: Paul Schlie <schlie at comcast dot net>
- Cc: Paolo Carlini <pcarlini at suse dot de>, <gcc at gcc dot gnu dot org>
- Date: 30 Dec 2004 02:30:30 +0100
- Subject: Re: G++ enums 'underlying type'
- Organization: Integrable Solutions
- References: <BDF896FA.86BF%schlie@comcast.net>
Paul Schlie <schlie@comcast.net> writes:
| > 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.
All that is moot; for to properly implement at the traits at issue
(is_enum), one needs hooks in the compiler. Therefore, whatever is
choosed does not really matter.
As far as Paolo's question is concerned, I think it would be hard for
him to have a proper implementation in 4.0.x -- unless we get a
seriously interesting interpretation of current rules for applying
a patch to mainline ;-)
-- Gaby