[GCC-XML] offset attribute problem

Kang, Gene Y (N-Simulogix) gene.y.kang at lmco.com
Tue Oct 12 21:51:30 EDT 2004

Brad, I recompiled this time as a .cpp module with g++ as you suggested.  I still get 4 as my output.

Thanks for your help,

-----Original Message-----
From:	Brad King [mailto:brad.king at kitware.com]
Sent:	Tue 10/12/2004 6:19 PM
To:	Kang, Gene Y (N-Simulogix)
Cc:	gccxml at gccxml.org
Subject:	Re: [GCC-XML] offset attribute problem

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 


More information about the gccxml mailing list