attribute data structure rewrite
Joseph S. Myers
jsm@polyomino.org.uk
Fri Sep 24 09:17:00 GMT 2004
On Fri, 24 Sep 2004, Giovanni Bajo wrote:
> 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?
Compile-time undefined for both C and C++, no diagnostic required; one
couldn't reasonably be given with the old macro implementations. Either
diagnose the use of non-integer-constant-expressions in offsetof, or
permit them but make them cause the result not to be an integer constant
expression.
--
Joseph S. Myers http://www.srcf.ucam.org/~jsm28/gcc/
http://www.srcf.ucam.org/~jsm28/gcc/#c90status - status of C90 for GCC 4.0
jsm@polyomino.org.uk (personal mail)
jsm28@gcc.gnu.org (Bugzilla assignments and CCs)
More information about the Gcc
mailing list