This is the mail archive of the
mailing list for the GCC project.
Re: Clarification required about bitfields
- From: Joseph Myers <joseph at codesourcery dot com>
- To: Konstantin Vladimirov <konstantin dot vladimirov at gmail dot com>
- Cc: GCC Development <gcc at gcc dot gnu dot org>
- Date: Wed, 23 Dec 2015 16:52:25 +0000
- Subject: Re: Clarification required about bitfields
- Authentication-results: sourceware.org; auth=none
- References: <CADn89gRWb8saSVTt3depbyw1=+01HDYbzbFkwLsgaHAi2cw8dg at mail dot gmail dot com>
See the WG14 reflector thread starting with
<http://www.open-std.org/jtc1/sc22/wg14/13560>, and the reference back to
the analysis of the textual history in
<http://www.open-std.org/jtc1/sc22/wg14/11100>. Effectively, you can
treat choices in this area as being implementation-defined or unspecified
(they can only arise when an implementation defines that types other than
"a qualified or unqualified version of _Bool, signed int, unsigned int"
can be used to declare bit-fields).
Nothing has ever defined how conversions to store out-of-range values in
bit-fields (other than _Bool bit-fields) would work for C if an
implementation defines such a bit-field not to have its own type (whereas
as noted in DR#120, this all falls out naturally if you treat the type as
including the width).
Joseph S. Myers