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.


Jonas
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to