Nicolas DICHTEL writes: > Hi all, > > here is the result on ARM of my little program: > > [EMAIL PROTECTED]:/usr/admin# ./test2 > 4 5 6 8 > 2 3 4 6 > > > Is it normal to add an attribute __packed__ on each union{} > contained in a structure, or is it a bug of my compiler ? > On X86, this kind of structure has always the good size.
gcc doesn't pack structs by default, but adheres to the ABI of the platform being targeted. If you ask for a union to be packed, you're allowing gcc to do something different from the platform ABI. gcc developers don't usually get to design the platform ABI. We merely try to write a compiler that implements it correctly. Andrew.