Node:BitSizeOf, Next:, Previous:BindingType, Up:Reference



BitSizeOf

Synopsis


function BitSizeOf (var x): SizeType;

Description

Returns the size of a type or variable in bits.

Conforming to

BitSizeOf is a GNU Pascal extension.

Example


program BitSizeOfDemo;
type
  Int12 = Integer attribute (Size = 12);
var
  a: Integer;
  b: array [1 .. 8] of Char;
  c: Int12;
  d: packed record
       x: Int12;
       y: 0 .. 3
     end;
begin
  WriteLn (BitSizeOf (a));    { Size of an `Integer'; usually 32 bits. }
  WriteLn (BitSizeOf (Integer));  { The same. }
  WriteLn (BitSizeOf (b));    { Size of eight `Char's; usually 64 bits. }
  WriteLn (BitSizeOf (c));    { e.g. 16 bits (smallest addressable space). }
  WriteLn (BitSizeOf (d));    { e.g. 16 }
  WriteLn (BitSizeOf (d.x));  { 12 }
  WriteLn (BitSizeOf (d.y))   { 2 }
end.

See also

SizeOf, AlignOf, TypeOf.