Hey all,
Consider the following record:
Code:
TMyRecord = record
ID: Word; //2 bytes
recSize: Integer; //4 bytes
Str: String; //4 bytes
b: Boolean; //1 bytes
a: char; //2 bytes
end;
In delphi 2010, when I enable {$A8}, sizeOf(TMyRecord) will return 16. Which strikes me because I thought each field would take 8bytes (or will be padded, until it takes 8 bytes).
It would correspond to the following memory layout:
Code:
WWxxxxxx
IIIIxxxx
SSSSxxxx
Bxxxxxxx
CCxxxxxx
However, this is not the case. How exactly are the fields packed together when I use 8-byte alignment?
Thanks
Bookmarks