[fpc-pascal] Memory alignment with FPC

dhkblaszyk at zeelandnet.nl dhkblaszyk at zeelandnet.nl
Thu Oct 11 15:00:08 CEST 2012


  

On 11 okt '12, Jonas Maebe wrote: 

> As mentioned before, it not
only depends on the platform, but also on the contents of the
object/record. E.g., a badly misaligned double will generally give much
worse performance even on Intel. 
> 
>> This makes me wonder if
>>
choosing a proper value for $PACKRECORDS could make my file readable
>>
safely on all platforms, only needing to convert the endianess if
>>
applicable. This would not force me to do manual padding in my
structs.
>> Say I use a value of 16 would that cover all ABI's FPC
currently
>> supports?
> 
> Yes.

So misalignment of for instance a
double (or whatever type) will only happen if the record is packed and
the packed value is smaller than what the ABI prescribes, correct?


Let's assume I set the record to packed 16bytes, this would make
reading and writing records as a whole safe on all platform/architecture
combinations right? Apart from a few padding bytes, what are the
performance penalties of doing this then? Why would there be penalties?


Darius 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20121011/be5d07c1/attachment.html>


More information about the fpc-pascal mailing list