[fpc-devel] data alignment and int64 (or qword, maybe any singlepiece of size 8 if any)

Jonas Maebe jonas.maebe at elis.ugent.be
Tue May 16 11:57:08 CEST 2006


On 16 mei 2006, at 11:50, Пётр Косаревский wrote:

> I myself don't have unsolved problems with alignment in records.
>
> I only point at some inconsistency with 16-byte alignment by  
> default: variables are 16-bytes aligned and their members of type  
> int64 may have addresses not divisible byt 4.

At least the AIX ABI requires a kind of alignment that can result in  
this sort of situations. Maybe other ABI's do as well.

> {$PACKRECORDS n} has almost nothing to do with this inconsistency.

It does, since the member alignment is defined by {$packrecords n}

> I wrote about default behavior.

There is a default for {$packrecords }, just like for all other  
settings.

> I wrote about dependency of alignment of variables on compiler  
> switch: if I want to conserve memory and may have int64 aligned (by  
> default) only by word, I don't want big gaps between variables  
> because of 16 bytes alignment.

You shouldn't get big gaps them between different variables if you  
specify a small alignment. You may get them between different record  
members if you don't change the packrecords setting as well.

> Originally I pointed to the lack of documentation (which states,  
> that the default alignment in records is 1-2 bytes).

That indeed must be fixed.


Jonas


More information about the fpc-devel mailing list