Chapter 3

All variables have a type. Free Pascal supports the same basic types as Turbo Pascal, with some extra types from Delphi. The programmer can declare his own types, which is in essence defining an identifier that can be used to denote this custom type when declaring variables further in the source code.

Type declaration

--type declaration- identifier-=  -type -;------------------------------

There are 7 major type classes :


--type --|-simple type--------------------------------------------
        |-string type--|
        -structured type--|
        - pointer type -|
        -progceenderuricalty tpypee-|
        -specialized type-|
        -type identifier-|

The last case, type identifier, is just a means to give another name to a type. This presents a way to make types platform independent, by only using these types, and then defining these types for each platform individually. Any programmer who then uses these custom types doesn’t have to worry about the underlying type size: it is opaque to him. It also allows to use shortcut names for fully qualified type names. e.g. define system.longint as Olongint and then redefine longint.

 3.1 Base types
  3.1.1 Ordinal types
  3.1.2 Real types
 3.2 Character types
  3.2.1 Char
  3.2.2 Strings
  3.2.3 Short strings
  3.2.4 Ansistrings
  3.2.5 UnicodeStrings
  3.2.6 WideStrings
  3.2.7 Constant strings
  3.2.8 PChar - Null terminated strings
 3.3 Structured Types
  3.3.1 Arrays
  3.3.2 Record types
  3.3.3 Set types
  3.3.4 File types
 3.4 Pointers
 3.5 Forward type declarations
 3.6 Procedural types
 3.7 Variant types
  3.7.1 Definition
  3.7.2 Variants in assignments and expressions
  3.7.3 Variants and interfaces