There is a line of C90 DRs and associated textual history (compare the 
relevant text in C90 and C99, or see my comparison of it in WG14 reflector 
message 11100 (18 Apr 2006)) to the effect of bit-fields acting like they 
have a type with the given number of bits; that line is what's followed by 
GCC for C.  The choice of type for a bit-field (possibly separate from 
declared type) was left explicitly implementation-defined after DR#315; 
that is, if an implementation allows implementation-defined declared types 
as permitted by C99 and later, whether the actual type of the bit-field in 
question is the declared type or has the specified number of bits is also 
implementation-defined.  The point in DR#120 regarding assignment to 
bit-fields still applies in C11: nothing other than the semantics of 
conversion to a type with the given number of bits defines how the value 
to be stored in a bit-field is computed if the stored value is not in 
range.

C++ chose a different route from those C90 DRs, of the width explicitly 
not being part of the type of the bit-field.  I don't know what if 
anything in C++ explicitly resolves the C90 DR#120 issue and defines the 
results of storing not-exactly-representable values in a bit-field.

-- 
Joseph S. Myers
jos...@codesourcery.com

Reply via email to