------- Comment #8 from bliss1940-bbs at yahoo dot com  2007-05-22 01:16 -------
(In reply to comment #7)
> On arm-elf structures are padded/aligned to a 4-byte boundary. This is a
> "feature" of the ABI. The microsoft compiler obviously conforms to a different
> ABI, which is why you get different results. Both are "correct".

Thanks everyone for your time and trouble.  I will go with the packed
attribute.

> Any code that relies on a particular structure layout or size is inherently
> unportable.
> EABI based targets (eg. arm-eabi) use a more conventional ABI.

Unfortunately so.  I think that structures with only chars would be portable if
only compilers didn't pad the end of them.  In fact my message classes are
portable between Microsoft on the PC and GNU on the ARM except for the sizeof()
thing.  

Defining inter-computer messages as classes with functions to manipulate the
data inside is so very handy that I will continue to do it and will use the
__attribute__((packed)) whenever necessary.

Thanks again,
Steve


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32016

Reply via email to