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


Alexandre Oliva <aoliva@redhat.com> writes:

> 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?

What I would argue for is that the typedef is equivalent to
    typedef unsigned char BF;
It's easy to document and easy to understand.  It's not elegant.

Ian


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