This is the mail archive of the
mailing list for the GCC project.
Re: How to use _Generic with bit-fields
- From: Wink Saville <wink at saville dot com>
- To: Joseph Myers <joseph at codesourcery dot com>
- Cc: Martin Sebor <msebor at gmail dot com>, GCC Development <gcc at gcc dot gnu dot org>
- Date: Mon, 22 Feb 2016 16:06:05 -0800
- Subject: Re: How to use _Generic with bit-fields
- Authentication-results: sourceware.org; auth=none
- References: <CAKk8iso7KLotY1WGwaO8FBvp27nFORAWdShqVGth=0Hrc+WVbQ at mail dot gmail dot com> <56C78A87 dot 4090601 at gmail dot com> <CAKk8isoF4gT_z9sscYmnetMZOCkaZUO0Gr9_sj7WQB86PEQxZg at mail dot gmail dot com> <alpine dot DEB dot 2 dot 10 dot 1602222140420 dot 26576 at digraph dot polyomino dot org dot uk> <CAKk8isr=pPy2v3vNhV5pMEz5bHpg9xUx_ExKEESU5i+xcbEjzg at mail dot gmail dot com> <alpine dot DEB dot 2 dot 10 dot 1602222345290 dot 26576 at digraph dot polyomino dot org dot uk>
I understand "long" bit fields are in ISO, but its a gcc extension so
it would seem it should play nice with as much of the language as
It seems the root of the problem here is the length encoding
in the type, why does gcc do that, does the standard
On Mon, Feb 22, 2016 at 3:48 PM, Joseph Myers <firstname.lastname@example.org> wrote:
> On Mon, 22 Feb 2016, Wink Saville wrote:
>> What about printing of "long" bit fields? I wonder if there should be an
>> option which indicates that bit field types should not include their length.
> "long" bit-fields aren't even guaranteed by ISO C to be supported at all;
> portable code must avoid them. The portable way to print values of
> arbitrary integer types is to cast to intmax_t / uintmax_t and then use
> corresponding formats; that works fine with such bit-fields as well as
> normal types.
> Joseph S. Myers