BitSizeOf function
Return size (in bits) of a variable or type.
Declaration
function BitSizeOf(X: TAnyType): LongIntDescription
BitSizeOf returns the size, in bits, of any variable or type-identifier.
For regular variables or types, this is the same as
SizeOf multiplied by 8,
but for bitpacked records, the result may be different.
This isn't really a RTL function. Its result is calculated at
compile-time, and hard-coded in the executable.
Errors
None.
See also
Example: ex122
Program Example122;
{ Program to demonstrate the BitSizeOf function. }
type
TB = bitpacked record
B1,B2,B3,B4 : Boolean;
end;
TNB = record
B1,B2,B3,B4 : Boolean;
end;
Var
I : Longint;
S : String [10];
begin
Writeln (BitSizeOf(I)); { Prints 32 }
Writeln (BitSizeOf(S)); { Prints 88 }
Writeln (BitSizeOf(TB)); { Prints 8 }
Writeln (BitSizeOf(TNB)); { Prints 32 }
end.An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
