[fpc-devel] data alignment and int64 (or qword,	maybe any singlepiece of size 8 if any)
    Peter Vreman 
    peter at freepascal.org
       
    Tue May 16 12:40:44 CEST 2006
    
    
  
> {$A-}
> type
>   a= record
>      a: int64;
>      b: byte;
>      end;
>
> var
>   x: a;
>   y: byte;        // these are
>   yy: longword;   //   9
>   zz: longword;   //     bytes
>   z: a;
>
> begin
> writeln(sizeof(a));
> writeln(longint(@x));
> writeln(longint(@y));
> writeln(longint(@z));
> end.
>
>
> This program makes me feel strange: it aligns records by 16 bytes for no
> reason (last two addresses are odd). (Don't forget {$A-})
You are mixing record alignment and memory alignment.
    
    
More information about the fpc-devel
mailing list