This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: typeof and bitfields
- From: Alexandre Oliva <aoliva at redhat dot com>
- To: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- Cc: "Dave Korn" <dave dot korn at artimi dot com>, "'Ian Lance Taylor'" <ian at airs dot com>, "'Neil Booth'" <neil at daikokuya dot co dot uk>, "'Matt Austern'" <austern at apple dot com>, <gcc at gcc dot gnu dot org>, "'Andrew Pinski'" <pinskia at physics dot uc dot edu>
- Date: 17 Jan 2005 17:38:08 -0200
- Subject: Re: typeof and bitfields
- Organization: Red Hat Global Engineering Services Compiler Team
- References: <NUTMEGZfv4eqfxrCXIj00001066@NUTMEG.CAM.ARTIMI.COM><m3wtugq7lg.fsf@uniton.integrable-solutions.net>
On Jan 14, 2005, Gabriel Dos Reis <gdr@integrable-solutions.net> wrote:
> That is an argument for not returning an int. It is not an argument
> for issueing error. Why not return int_with_2bits?
Let's see...
struct x {
unsigned int i:2;
} *p;
typedef __typeof(p->i) BF;
struct y {
BF j;
BF k:14;
} *q;
int main() {
__typeof(q->j) m = 7;
}
What do you expect to get from this piece of code?
Is y::j a bit-field, even though it's not declared with the bit-field
notation?
Is the declaration of y::k valid? What is the size of struct y? Do j
and k pack into a single unsigned int?
Heck, is the declaration of BF valid? What if you use BF to declare a
global variable, or a function argument?
--
Alexandre Oliva http://www.ic.unicamp.br/~oliva/
Red Hat Compiler Engineer aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist oliva@{lsd.ic.unicamp.br, gnu.org}