[fpc-devel] Alignment question

Sergei Gorelkin sergei_gorelkin at mail.ru
Mon Nov 21 06:02:54 CET 2011


20.11.2011 23:38, Jonas Maebe пишет:
>
> On 20 Nov 2011, at 21:18, Florian Klämpfl wrote:
>
>> Sorry, I meant recordalignmin.
>
> And I didn't think of that setting. Yes, that should indeed work.
>
>
It doesn't, {$codealign recordnmin} changes only alignment of fields within the record, not 
alignment of the record itself. In the following example:

{$mode objfpc}{$h+}
unit a;

interface

{$codealign recordmin=16}
type
   arr=record x,y: int64 end;

   t=record
     a1: arr;
     a2: word;
   end;

implementation

end.

you get sizeof(arr)=24, sizeof(t)=40, while recordalignment of t stays equal to 8.

Regards,
Sergei



More information about the fpc-devel mailing list