next up previous contents index search.gif
Next: 3.1 Base types Up: 1. The Pascal language Previous: 2.2 Typed constants

3. Types

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

Type declaration

\begin{syntdiag}\setlength {\sdmidskip}{.5em}\sffamily\sloppy \synt{type\ declaration} \synt{identifier} \lit*= \synt{type} \lit* ;\end{syntdiag}
There are 7 major type classes :

Types

\begin{syntdiag}\setlength {\sdmidskip}{.5em}\sffamily\sloppy \synt{type}
\(
\sy...
...r\ type} \\
\synt{procedural\ type}\\
\synt{type\ identifier}
\)\end{syntdiag}
The last class, type identifier, is just a means to give another name to a type. This gives you a way to make types platform independent, by only using your own types, and then defining these types for each platform individually. The programmer that uses your units doesn't have to worry about type size and so on. It also allows you to use shortcut names for fully qualified type names. You can e.g. define system.longint as Olongint and then redefine longint.

Subsections

root
1999-06-10