[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 10:44:28 CEST 2006


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

> 1. I think, that when you optimize for size, default options should  
> be "avoid alignment when possible".
> 2. SSE2 is a special case and, by the way, will FPC support integer  
> SSE2 operations? (Current mmx unit is not widely used, so Florian  
> K. said it is low priority.)
>
> Compile this with "-OG" and notice, that while record has size 9,  
> individual variables of that type are aligned by 16-byte. (FPC  
> 2.0.3, i386, win32)
> And it does not depend on processor model: -Cp386 and -CpPENTIUM4  
> yield the same results.

Record packing is separate from optimization or target processors,  
because otherwise this would be too confusing (e.g. you'd have  
problems if you want to share memory or files between programs  
compiled with different optimization modes or for a different  
processor). In other compilers (both Pascal and C), record packing/ 
alignment is also completely separate from optimization switches.

If you want a particular alignment mode other than the default, use  
{$packrecords x}


Jonas


More information about the fpc-devel mailing list