Sign in Join
FPDoc Onlineexperiment

SizeOf function

In unit System

Return size (in bytes) of a variable or type.

Declaration

pascal
function SizeOf(X: TAnyType): LongInt

Description

SizeOf returns the size, in bytes, of any variable or type-identifier.

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: ex63

pascal
Program Example63;

{ Program to demonstrate the SizeOf function. }
Var
  I : Longint;
  S : String [10];

begin
  Writeln (SizeOf(I));  { Prints 4  }
  Writeln (SizeOf(S));  { Prints 11 }
end.

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.