Nullable types

From Free Pascal wiki
Revision as of 16:19, 6 August 2022 by Kai Burghardt (talk | contribs) (resolve Category: Pages using deprecated enclose attributes)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

English (en) suomi (fi)

Nullable types are types which can have no value (can be unassigned). One such type in Pascal is Pointer type which can have nil value which means that it isn't assigned to any specific address. Same behavior can be implemented using generic types and advanced records with operator overloading.

The Nullable unit is part of FPC since 3.2.2 and its code can be seen in the GitLab repository: nullable.pp.

Then you can define nullable types like:

NullableChar = TNullable<Char>;
NullableInteger = TNullable<Integer>;
NullableString = TNullable<string>;

See also

The standard nullable type in Object Pascal is Variant.

External links