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

9.26 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;
var
  a: Integer;
  b: array [1 .. 8] of Char;
  c: Integer (12);
  d: packed record
       x: Integer (12);
       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

section 9.257 SizeOf, section 9.5 AlignOf, section 9.286 TypeOf.



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