[fpc-pascal] Memory alignment with FPC

Mark Morgan Lloyd markMLl.fpc-pascal at telemetry.co.uk
Wed Oct 10 15:07:21 CEST 2012


Sven Barth wrote:
> Am 10.10.2012 12:02, schrieb dhkblaszyk at zeelandnet.nl:
>> Does FPC ensure the same memory alignment for records and objects over
>> different platforms? If I want to be sure to have the same alignment
>> must I use packed (with possibly some aligning assigned) records instead
>> in combination with data types that are guaranteed to be of the same
>> size over the different platforms (eg byte, word, single) ? Or do
>> unpacked records behave the same over different platforms?
> 
> Please note that you might also need to take care of different endianess 
> (big endian vs. little endian) if you want to transfer such record data 
> (e.g. through files) between systems with different endianess. In that 
> case you'll need to write the record field by field and convert the 
> endianess in one of the two cases...

I've had some success defining a custom := operator for this.

-- 
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]



More information about the fpc-pascal mailing list