[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
function AlignOf (var x): Integer; |
Returns the alignment of a type or variable in bytes.
`AlignOf' is a GNU extension.
program AlignOfDemo; var a: Integer; b: array [1 .. 8] of Char; begin WriteLn (AlignOf (a)); { Alignment of `Integer'; usually 4 bytes. } WriteLn (AlignOf (Integer)); { The same. } WriteLn (AlignOf (b)); { Alignment of `Char'; usually 1 byte. } end. |
Although the array is bigger than a single char, it is accessed char by char, so there usually is no need to align it on a 4 byte boundary or such. (This may be false on some platforms.)
section 9.257 SizeOf, section 9.26 BitSizeOf, section 9.286 TypeOf.