Hi, the SizeOf(MyRec) gives 20, while the size is obviously only 18 (including the alignment dummy bytes). Are the 2 extra bytes something related to the variable alignment issue (I would myself prefer that the value 18 is given back by the function SizeOf, of course the dummy bytes inserted for alignment have to be counted as they are now).
Thanks in advance.
- Capture18-05-2020-19.15.37.jpg (207.84 KiB) Viewed 1868 times
The code is the following:
Code: Select all
program Word_Alignment;
{ Declarations section }
Type TArr = Array[5] of byte;
Type Trec = record
Byte1: byte;
Word1: word;
Byte2: byte;
Dword1: dword;
Byte3: byte;
Arr1: TArr;
end;
var MyRec: TRec; volatile;
Siz: byte;
begin
{ Main program }
Siz := SizeOf(MyRec);
end.
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)