[fpc-pascal] alignment of records

Jonas Maebe jonas.maebe at elis.ugent.be
Fri Aug 7 07:26:56 CEST 2015


Xiangrong Fang wrote:
> It seems that $packrecord does not work at all.

It works fine.

> I did some research and
> found this document:
>
> http://www.freepascal.org/docs-html/ref/refsu19.html

The documentation seems to be outdated regarding the alignment of 
arrays. Arrays probably used to be aligned based on the size of the 
entire array at one point (it's before recorded history, i.e. before 
September 2000), or maybe the record field insertion code used to 
contain some special (broken) logic for arrays that ignored their 
alignment and instead used their size.

In any case, the alignment requirement of an array is and has been for 
quite some time the alignment requirement of its individual elements, 
and the alignment of a field's type is what's used to determine its 
offset in a record (with a maximum of the current packrecords setting).


Jonas



More information about the fpc-pascal mailing list