Data type
Bahasa Indonesia · Deutsch · English · Español · Français · Italiano · Русский
General
This page provides an assortment of data types in Free Pascal.
A data type is a template for a data field.
The data type of a field defines how the compiler and processor interpret it's content.
The visibility of a data field depends on the location of it's declaration.
Integer types
Unsigned types
Data fields of unsigned integral types can only contain positive integral numbers.
- UInt8 - Range: (0 .. 255)
- Byte - Range: (0 .. 255)
- UInt16 - Range: (0 .. 65535)
- Word - Range: (0 .. 65535)
- NativeUInt - Range: depends on the processor type.
- DWord - is equivalent to Longword.
- Cardinal - is equivalent to Longword.
- UInt32 - Range: (0 .. 4294967295)
- Longword - Range: (0 .. 4294967295)
- UInt64 - Range: (0 .. 18446744073709551615)
- QWord - Range: (0 .. 18446744073709551615)
Signed types
Data fields of signed integral types can contain positive and negative integral numbers.
- Int8 - Range: (-128 .. 127)
- ShortInt - Range: (-128 .. 127)
- Int16 - Range: (-32768 .. 32767)
- SmallInt - Range: (-32768 .. 32767)
- Integer - Range: is equivalent either to Smallint or Longint (for 16 respectively 32 bit processors).
- Int32 - Range: (-2147483648 .. 2147483647)
- NativeInt - Range: depends on the processor type.
- LongInt - Range: (-2147483648 .. 2147483647)
- Int64 - Range: (-9223372036854775808 .. 9223372036854775807)
Floating-point types
Data fields of a floating-point type can contain:
- positive and negative integral numbers with possible round-off errors.
- positive and negative floating-point numbers.
- Single - Range: (1.5E-45 .. 3.4E38)
- Real - Range: depends on the platform.
- Real48 - Range: 2.9E-39 .. 1.7E38
- Double - Range: (5.0E-324 .. 1.7E308)
- Extended - Range: depends on the platform.
- Comp - Range: (-2E64+1 .. 2E63-1)
- Currency - Range: (-922337203685477.5808 .. 922337203685477.5807)
Boolean types
Data fields of boolean type contain truth values.
- Boolean - Range: (True, False), 8 Bit
- ByteBool - Range: (True, False), 8 Bit
- WordBool - Range: (True, False), 16 Bit
- LongBool - Range: (True, False), 32 Bit
Enumeration types
Data fields of an enumeration type are "lists" (enumerations...) of integral unsigned constants.
- Enum Type - Range: (integral data types)
Char types
Char types with single byte encoding
- Char - Constant length: 1 byte, representation: 1 character.
- ShortString - Maxmimum length: 255 characters.
- String - Maxmimum length: Shortstring or Ansistring (depends in the used compiler switch).
- PChar - Pointer to a null-terminated string without length restriction.
- AnsiString - No length restriction.
- PAnsiChar - Pointer to a null-terminated string without length restriction.
See the overview of the different character and string types.
Char types with multi byte encoding
(The encoding with 2 or 4 bytes is system dependent.\
- WideChar - Constant length: 2 or 4 bytes, representation: 1 character.
- WideString - No length restriction.
- PWideChar - Pointer to a null-terminated wide string without length restriction.
- UnicodeChar - Constant length: 2 or 4 bytes, representation: 1 character.
- UnicodeString - No length restriction.
- PUnicodeChar - Pointer to a null-terminated Unicode string without length restriction.
See the overview of the different character and string types.
Variant types
Constants
- Untyped constants
- Const - Only simple data types can be used.
- Typed constants
- Const - Simple data types as well as records and arrays can be used.
- Resource Strings
- Resourcestring - Used for localisation (not available in all compiler modes).
Structural types
- Array - The size of the array depends on the type and the number of elements it contains.
- Record - A combination of multiple data types.
- Set - A set of elements of an ordinal type; the size depends on number of elements it contains.
Subrange types
- subrange types are a subset of a base type.
Pointer
- Pointer - The size depends on the processor type.
Classes and objects
- Object - Developed under Turbo Pascal 5.5 for DOS and the precursor of class.
- Class - Developed under Delphi 1.0 for Windows and the successor of object.
See also
From the Free Pascal wiki, page "Data type", as it stood on 2021-08-29 after a change by Mozi, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.
Talk about this page
Nobody has opened a bench for this page yet. Sign in to open one.
