Node:AlignOf, Next:all, Previous:Addr, Up:Reference

### AlignOf

#### Synopsis

    function AlignOf (var x): Integer;

#### Description

Returns the alignment of a type or variable in bytes.

#### Conforming to

`AlignOf` is a GNU Pascal 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

SizeOf, BitSizeOf, TypeOf.