Chapter 6. System Constants

This chapter is separate from Chapter 5, to make it easier to find the information you need. Instead of cluttering Chapter 5 with all the individual identifiers, this chapter organizes the system constants logically. All the constant literals described in this chapter are defined in the System unit, so they are available at all times.

Variant Type Codes

The VarType function returns the type code of a Variant. The type code is a small integer that contains a type identifier with the optional modifiers varArray and varByRef. Any type except varEmpty and varNull can have the varArray modifier. Delphi automatically takes care of the varByRef modifier. For more information, see the discussion of the Variant type in Chapter 5. Table 6-1 lists the type identifiers, and Table 6-2 lists the optional modifiers.

Table 6-1. Variant Type Identifiers

Literal

Value

Description

varEmpty

$0000

Variant not assigned

varNull

$0001

Null value

varSmallint

$0002

16-bit, signed integer

varInteger

$0003

32-bit, signed integer

varSingle

$0004

32-bit floating-point number

varDouble

$0005

64-bit floating-point number

varCurrency

$0006

64-bit fixed point number with four decimal places

varDate

$0007

64-bit floating-point date and time

varOleStr

$0008

#0-terminated wide string

varDispatch

$0009

IDispatch interface

varError

$000A

32-bit error code

varBoolean

$000B

Logical True or False

varVariant

$000C

Pointer to another Variant

varUnknown ...

Get Delphi in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.