This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: sizeof different in x86 and arm.


On 24-May-01, Wiesner, Robert wrote:
>the structure layout and alignement is implementation defined. You may never
>make any asumption about the structure layout within the memory or the site
>of the structures. E.g.:
>
>struct x {
>       int  a;
>       char b;
>       int  c;
>       char d;
>};
>
>what is the size of this structure? Is it 32 byte (64 bit alignement), 16
>byte (32 bit alignement), 8 byte (16 bit integer) or may be 10 bytes? Does
>the memory layout looks like
>a a a a b c c c c d
>or
>a a a a c c c c b d
>Since this is also implementation defined. Also the organization of global /
>local symbols.

No, there is a requirement that the elements stay in the same order.  Padding
can go anywhere but the beginning.

Another way to transport data between architectures is to sprintf it out, and
then read it back with sscanf.  I'm not aware of any nicer way to pickle data
that actually works across platforms.

 - ken

------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]