| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
function BitSizeOf (var x): SizeType; |
Returns the size of a type or variable in bits.
`BitSizeOf' is a GNU Pascal extension.
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.
|
section 9.257 SizeOf, section 9.5 AlignOf, section 9.286 TypeOf.