[GCC-XML] offset attribute problem

Brad King brad.king at kitware.com
Tue Oct 12 21:19:52 EDT 2004


Kang, Gene Y (N-Simulogix) wrote:
> Brad, I had to make a few modifications to get the test code to run on
> my box:
> 
> #include "stdio.h"
> #include "stddef.h"
> 
> struct A
> {
>    int x;
>    int y;
> };
> 
> int main()
> {
>    printf("%lu\n", offsetof(struct A, y));
>    return 0;
> }
> 
> The resulting output from running was 4.  I'm using gcc3.2.

That is probably because you used the C compiler.  Please try putting it 
in a file with a .cxx extension and use g++.  Then you should not need 
the "struct A" part.  The C++ part of gcc is what we really need to test 
anyway.

-Brad



More information about the gccxml mailing list