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: Help with bit-field semantics in C and C++


David Carlton wrote:

On Tue, 24 Aug 2004 14:11:17 -0700, Mark Mitchell <mark@codesourcery.com> said:



The standard is just plain not clear here. There's nothing that says
definitively what should happen, either with the conversion or with
the subsequent use, assuming that conversion to a value outside the
enum range is permitted.



But that last assumption isn't correct, is it? I don't see how that's consistent with 7.2p9: it talks about "the resulting enumeration value", which should surely mean that a value outside the enum range _isn't_ permitted.

I think you're reading too cleverly.

When reading the C++ standard, it pays to remember that it's big, complex, and some parts are better written than others. The people writing it just didn't think of all the corner cases, whichi is not to criticize; it's just a fact. I know of no compilers that do as you suggest, and I think it would disappoint users to have extra conversion instructions inserted. Since EDG passes basically every known testsuite, that means no testsuites agree with your interpretation. If we did as you suggest, we'd end up with -ffast-enums to get the behavior everyone expects.

--
Mark Mitchell
CodeSourcery, LLC
(916) 791-8304
mark@codesourcery.com


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