This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: How to use _Generic with bit-fields
- From: Joseph Myers <joseph at codesourcery dot com>
- To: Wink Saville <wink at saville dot com>
- Cc: Martin Sebor <msebor at gmail dot com>, GCC Development <gcc at gcc dot gnu dot org>
- Date: Mon, 22 Feb 2016 23:48:29 +0000
- 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>
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
joseph@codesourcery.com