RAD Studio (Common)
ContentsIndex
PreviousUpNext
Data Types, Variables, and Constants

This section describes the fundamental data types of the Delphi language.

Name 
Description 
This topic presents a high-level overview of Delphi data types. 
Simple types - which include ordinal types and real types - define ordered sets of values.
The ordinal types covered in this topic are:
  • Integer types
  • Character types
  • Boolean types
  • Enumerated types
  • Real (floating point) types
 
This topic describes the string data types available in the Delphi language. The following types are covered:
  • Short strings (ShortString)
  • ANSI strings (AnsiString)
  • Unicode strings (UnicodeString and WideString)
 
Instances of a structured type hold more than one value. Structured types include sets, arrays, records, and files as well as class, class-reference, and interface types. Except for sets, which hold ordinal values only, structured types can contain other structured types; a type can have unlimited levels of structuring.
By default, the values in a structured type are aligned on word or double-word boundaries for faster access. When you declare a structured type, you can include the reserved word packed to implement compressed data storage. For example, type TNumbers = packed array [1..100] of Real;
Using packed slows data access... more 
A pointer is a variable that denotes a memory address. When a pointer holds the address of another variable, we say that it points to the location of that variable in memory or to the data stored there. In the case of an array or other structured type, a pointer holds the address of the first element in the structure. If that address is already taken, then the pointer holds the address to the first element.
Pointers are typed to indicate the kind of data stored at the addresses they hold. The general-purpose Pointer type can represent a pointer to... more 
Procedural types allow you to treat procedures and functions as values that can be assigned to variables or passed to other procedures and functions. 
This topic discusses the use of variant data types. 
To understand which operations can be performed on which expressions, we need to distinguish several kinds of compatibility among types and values. These include:
  • Type identity
  • Type compatibility
  • Assignment compatibility
 
This topic describes the syntax of Delphi type declarations. 
A variable is an identifier whose value can change at runtime. Put differently, a variable is a name for a location in memory; you can use the name to read or write to the memory location. Variables are like containers for data, and, because they are typed, they tell the compiler how to interpret the data they hold. 
Several different language constructions are referred to as 'constants'. There are numeric constants (also called numerals) like 17, and string constants (also called character strings or string literals) like 'Hello world!'. Every enumerated type defines constants that represent the values of that type. There are predefined constants like True, False, and nil. Finally, there are constants that, like variables, are created individually by declaration.
Declared constants are either true constants or typed constants. These two kinds of constant are superficially similar, but they are governed by different rules and used for different purposes. 
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!