Help with bit-field semantics in C and C++

Mark Mitchell mark@codesourcery.com
Tue Aug 24 21:54:00 GMT 2004


Mike Stump wrote:

> On Tuesday, August 24, 2004, at 02:38  PM, David Carlton wrote:
>
>>> 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.
>
>
> Grrr...  It _is_ permitted.  The standard is perfectly clean on this 
> issue.

Pragmatically, I'd say that if there's this much disagreement among 
people who know the standard very well, then the standard is not very 
clear.  The best way forward here is probably to submit a DR, and see 
what the committee has to say.

Roger, I'd say that if the effecient, safe way to fix the 3.4 regression 
is to make TYPE_PRECISION the width of the underlying type, and that 
doesn't break anything else, that's an acceptable change, especially for 
a release branch.

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



More information about the Gcc mailing list