This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Offset and Bit Mask for Bit Fields?
- From: Andrew Haley <aph at redhat dot com>
- To: Dimitry Golubovsky <golubovsky at gmail dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Mon, 11 Jul 2005 15:13:45 +0100
- Subject: Re: Offset and Bit Mask for Bit Fields?
- References: <bcba51a05071107076533b85b@mail.gmail.com>
Dimitry Golubovsky writes:
>
> If one wants to automatically determine offset of a regular field in a
> C structure, one uses `offsetof'
>
> According to the documentation,
>
> ==============
> This macro (offsetof) won't work if member is a bit field; you get an
> error from the C compiler in that case.
> ==============
Yes, because it's not addressable.
> Do there exist any means in gcc to measure offsets (of enclosing
> integer field) and bit mask for bit fields?
No.
> If not, any chance to add them in the future?
I doubt it. We're very reluctant to add new language extensions to C,
and this one would be very problematic.
Andrew.