BitSizeOf¶
Return size (in bits) of a variable or type.
Description¶
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.
Remark:
This isn't really a RTL function. Its result is calculated at compile-time, and hard-coded in the executable.
Errors¶
None.
See also¶
| Name | Description |
|---|---|
| SizeOf | Return size (in bytes) of a variable or type. |
| Addr | Return address of a variable. |
Example¶
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.