On Thu, Nov 23, 2006 at 04:45:09PM +0100, Ren? Scharfe wrote: > Andy Whitcroft schrieb: > > You see packing attributes applied to similar things in the kernel. > > Perhaps they are relevant here? > > Is there not some kind of attribute thing we can apply to this structure > > to prevent the padding? You see that in the kernel from time to time. > > > > struct foo { > > } __attribute__((packed)); > > Yes, that would be nice, but unfortunately __attribute__ is no standard > C. There is no standard C way to pack structures. Some compilers use #pragma's, gcc uses __attribute__((packed)). > Is there really a compiler that inserts padding between arrays of > unsigned chars? Yes, that compiler is called "gcc". #include <stdio.h> struct foo { unsigned char a[3]; unsigned char b[3]; }; int main(void) { printf("%d\n", sizeof(struct foo)); return 0; } On i386 that prints 6, on ARM it prints 8. Erik -- +-- Erik Mouw -- www.harddisk-recovery.com -- +31 70 370 12 90 -- | Lab address: Delftechpark 26, 2628 XH, Delft, The Netherlands - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html