Xavier DEBREUIL writes:
> Consider the following structure :
> struct foo{
> u8 buf[5];
> u8 frame[0];
> } ;
>
> sizeof( foo ) returns 8 when I use the arm-linux-gcc : why is this ? could
> someone explain me why ?
Because the compiler pads the structure to the next word boundary. This is
allowable by ANSI, and any code that assumes structure layout is fundamentally
broken.
> sizeof( foo ) returns 5 when I use the gcc : why is this ? could someone
> explain me why ?
Because there is no padding on x86.
> Is there any option for the arm-linux-gcc to give the same result as the gcc ?
Yes, but it will break binary compatability most vilely.
_____
|_____| ------------------------------------------------- ---+---+-
| | Russell King [EMAIL PROTECTED] --- ---
| | | | http://www.arm.linux.org.uk/ / / |
| +-+-+ --- -+-
/ | THE developer of ARM Linux |+| /|\
/ | | | --- |
+-+-+ ------------------------------------------------- /\\\ |
_______________________________________________
http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm