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]

Re: [PATCH] Fix for short-enums comparison bug


>   In message <199902112216.RAA27319@wagner.Princeton.EDU>you write:
>   > I seriously doubt it, since arguments to integer operators undergo
>   > integral promotion.  The rules are different for C++, but I believe
>   > the answer is no, since none of the standard integral types is allowed
>   > to have only 2 bits.
> I'm not looking for "I doubt/I believe".  I need folks to actually check the
> relavent standard and say "The standard ..." :-)

The relevant part of the C++ standard has the label "dcl.enum": look
for .../dcl.html#dcl.enum in your favorite copy of the standard (I
assume you have an up-to-date version inside Cygnus).

I'm currently looking at the Dec. 96 draft, so I don't know if there were
changes made later (you can check your local copy).  Two things are
described: the legal integral values that can be assigned to the enum, and
the "underlying type", which is implementation-dependent but can't be
larger than int unless there are enum values that don't fit in int or
unsigned int.

Stroustrup "The C++ Programming Language, Third Edition"'s section 4.8 may
be a clearer explanation of what is intended (though of course it is
non-normative).


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