attribute data structure rewrite

Andreas Schwab schwab@suse.de
Fri Sep 24 08:40:00 GMT 2004


"Giovanni Bajo" <giovannibajo@libero.it> writes:

> Anothing thing I have been shown today is that we currently reject this:
>
> ----------------------------------------
> #include <stddef.h>
> #include <stdio.h>
>
> struct A { char foo[10]; };
>
> void bar(void) {
>     int i;
>     for (i=0;i<10;i++)
>         printf("%d\n", offsetof(struct A, foo[i]));
> }
> --------------------------------------
>
> but we used to accept it.  Any idea about its legality? Workarounds?

offsetof (struct A, foo[0]) + i * sizeof (foo[0])

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."



More information about the Gcc mailing list