On 24 May 2011, at 15:54, Carsten Bager wrote:

I have a data record ("sVar_typ") compiled with the 2.2.5 arm compiler. It has the size of
32728 byte.
Now I try to compile with the 2.4.5 arm compiler it has the size of 32736 byte.

I write the addresses of the variables in the record, they have not changed.
It looks like the compiler just adds 8 byte to the record at the end.
If I use "Packed" in the record, the 8 byte disappears.
Because the record is used in a file, I have to know the size.
Is this an indented behavior of the compiler?

The size of non-packed records can change at any time between compiler releases. If you need a known layout, you must use a packed record.

Padding at the end of a record is generally added to make sure that if such a record appears in an array, subsequent items all have the required alignment. I don't immediately see why the compiler would think that record needs alignment to a multiple of 16 bytes though (afaik, we don't support any datatypes on the ARM that require such an alignment).


Jonas
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to