[fpc-pascal] Cache-line alignment for records
Matias Ezequiel Vara Larsen
matiasevara at gmail.com
Thu Mar 30 09:13:50 CEST 2023
On Wed, Mar 29, 2023 at 11:07:18PM +0200, Jonas Maebe via fpc-pascal wrote:
> On 29/03/2023 16:00, Matias Ezequiel Vara Larsen via fpc-pascal wrote:
> > So if I have a type like:
> >
> > test = record
> > r: DWord;
> > s: Word;
> > end;
> >
> > Then, I define the variable `nada` as an array of `test` type:
> >
> > var
> > nada: array[0..2] of test;
> >
> > Is the `@nada[1].r` element aligned to 4-bytes?
>
> Records always get padded to a multiple of their internal alignment
> requirement. Unless you're on a system where the default packrecords value
> is 2 (msdos-i8086 has that probably), the above record's internal field
> alignment is 4 and hence its size will also be padded to a multiple of 4.
>
Thanks for the clarification,
Matias
More information about the fpc-pascal
mailing list