-fpack-struct doesn't work under g++
Tom
tomATsnsys.com
Thu Sep 16 07:56:00 GMT 1999
The switch '-fpack-struct' doesn't pack structs under g++.
g++ --version
egcs-2.90.29 980515 (egcs-1.0.3 release)
typdef struct
{
unsigned short a;
unsigned long b;
} MyStruct;
void main(int argc, char** argv)
{
MyStruct S;
printf("%d\n",(unsigned long)&S.b - (unsigned long)&S);
}
g++ -fpack-struct -c test.cpp -o test.o
g++ test.o -o test
The result when run is:
4
when it should be:
2
Tom
More information about the Gcc-bugs
mailing list