Alignment Attribute
Original Reporter info from Mantis: ravi
-
Reporter name: ravi dion
Original Reporter info from Mantis: ravi
- Reporter name: ravi dion
Description:
Since FPC supports attributes it'd be nice to control alignment through it
Steps to reproduce:
{$A4}
type
TMyRecordA = record
x: Integer;
y: Int64;
end;
TMyRecordB = record
x: Integer;
[Align(8)]
y: Int64;
end;
var
a: TMyRecordA;
b: TMyRecordB;
offset: Integer;
begin
offset := PByte(@a.y) - PByte(@a);
Writeln(SizeOf(a));
Writeln(offset);
offset := PByte(@b.y) - PByte(@b);
Writeln(SizeOf(b));
Writeln(offset);
Additional information:
https://wiert.me/2020/09/25/delphi-the-use-of-alignattribute-indicate-the-alignment-of-a-field/
Mantis conversion info:
- Mantis ID: 37822
- Version: 3.3.1