typeof and bitfields
Alexandre Oliva
aoliva@redhat.com
Mon Jan 17 20:02:00 GMT 2005
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}
More information about the Gcc
mailing list