Пока ни у кого из гуру FPC нет времени отвечать, давайте рассмотрим этот вопрос. Вот код для этого:
program Project1;
type
TByteArray = packed array[Low(Word)..High(Word)] of Byte;
PByteArray = ^TByteArray;
TMyRec = packed record
f1, f2, f3, f4, f5, f6, f7, f8: Byte;
end;
{ TMyClass1 }
TMyClass1 = class
mark1: Byte;
f1, f2, f3, f4, f5, f6, f7, f8: Byte;
mark2: Byte;
r: TMyRec;
mark3: Byte;
constructor Create;
procedure ShowMe; // Dump of the object's data
end;
{ TMyClass1 }
constructor TMyClass1.Create;
begin
mark1 := 66;
mark2 := 77;
mark3 := 88;
end;
procedure TMyClass1.ShowMe;
var
data: PByteArray;
i: Word;
begin
data := Pointer(Self);
for i := 0 to 15 + 4 + 3 do // 4 - some unknown data at the beginning of the class, 3 - marks
Writeln(data^[i]);
end;
var
test: TMyClass1;
begin
test := TMyClass1.Create;
try
test.ShowMe;
Readln;
finally
test.Free;
end;
end.
И вывод:
0
192
64
0
66 <- Data starts, simple fields
0
0
0
0
0
0
0
0
77 <- Second data portion, record
0
0
0
0
0
0
0
0
88 <- Data ends
Как видим, в обоих случаях 8 полей занимают 8 байт.
Удачи.
person
Abelisto
schedule
07.09.2015