sizeof different in x86 and arm.
Mike Szabo
mszabo@intrinsix.com
Thu May 24 06:42:00 GMT 2001
I am not sure if this is a valid pragma in gcc but I have always used on
other compilers:
#pragma pack(4)
struct
{
U32 x;
U8 y
}
#pragma pack()
This forces the structure to be built using a multiple of 4 bytes, i.e 8
bytes. Change the 4 to a 1 and it will be build on a multiple of 1 byte
(i.e. no extra space) 5 bytes. "#pragma pack()" with no args restores the
default of the compiler
-mike
> -----Original Message-----
> From: crossgcc-owner@sources.redhat.com
> [ mailto:crossgcc-owner@sources.redhat.com]On Behalf Of Cliff Tsai
> Sent: Thursday, May 24, 2001 6:42 AM
> To: crossgcc
> Subject: sizeof different in x86 and arm.
>
>
> Hi:
> I have a simple struct as follow
>
> struct test_align
> {
> unsigned char Name[21];
> unsigned char Version[8];
> };
>
> But on cygwin for x86,the sizeof(struct test_align) is 29;
>
> but on cygwin for arm,the sizeof(struct test_align) return 32
>
> WHY.
>
>
>
>
>
> ------
> Want more information? See the CrossGCC FAQ,
> http://www.objsw.com/CrossGCC/
> Want to unsubscribe? Send a note to
> crossgcc-unsubscribe@sourceware.cygnus.com
>
------
Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com
More information about the crossgcc
mailing list