[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

9.5 AlignOf

Synopsis

 
function AlignOf (var x): Integer;

Description

Returns the alignment of a type or variable in bytes.

Conforming to

`AlignOf' is a GNU extension.

Example

 
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.)

See also

section 9.257 SizeOf, section 9.26 BitSizeOf, section 9.286 TypeOf.



This document was generated by Frank Heckenbach on May, 10 2002 using texi2html