This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: typeof and bitfields


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}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]