Unit 'System' Package
[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] [#rtl]

Default

Return Default initialized value.

Declaration

Source position: system.fpd line 93

function Default(

  const T: AnyType

):AnyType;

Description

Default is a compiler intrinsic: it returns for every type T a default value. In essence, this is a block of memory that is zeroed out. It can be used to correctly initialize most types (see below). Most importantly, it can be used to correctly initialize a managed type. It also works using a generic type template.

This function must not be used on a type where 0 (or a block of zeroes) is not a valid value for that type. In particular, it must not be used on the file types or complex types that contain a file type. Similarly, if you use it on enumerated types and range types which do not have an element with ordinal value 0, the use of this function will result in invalid values. In both cases, the compiler will not give an error if you do use Default on variables of the mentioned types, but the result will be an invalid value.

See also

TypeInfo

  

Return pointer to type information for type.

Initialize

  

Initialize memory block using RTTI.

Finalize

  

Finalize (clean up) memory block using RTTI.

ManagedTypes

  

A list of managed types.


Documentation generated on: Oct 02 2024