Quick start manual

iii
Chapter 1
Introduction 1-1
What’s in this manual? . . . . . . . . . . . . . . 1-1
Using Delphi . . . . . . . . . . . . . . . . . . 1-1
Typographical conventions . . . . . . . . . . 1-2
Other sources of information . . . . . . . . . . . 1-2
Software registration and
technical support . . . . . . . . . . . . . . . . . 1-3
Part I
Basic language description
Chapter 2
Overview 2-1
Program organization . . . . . . . . . . . . . . . 2-1
Delphi source files . . . . . . . . . . . . . . . 2-2
Other files used to build applications . . . . 2-2
Compiler-generated files . . . . . . . . . . . 2-3
Example programs. . . . . . . . . . . . . . . . . 2-3
A simple console application . . . . . . . . . 2-3
A more complicated example . . . . . . . . . 2-4
A native application . . . . . . . . . . . . . . 2-5
Chapter 3
Programs and units 3-1
Program structure and syntax . . . . . . . . . . 3-1
The program heading . . . . . . . . . . . . . 3-2
The program uses clause . . . . . . . . . . . 3-2
The block . . . . . . . . . . . . . . . . . . . . 3-2
Unit structure and syntax . . . . . . . . . . . . . 3-3
The unit heading . . . . . . . . . . . . . . . . 3-3
The interface section . . . . . . . . . . . . . . 3-4
The implementation section. . . . . . . . . . 3-4
The initialization section. . . . . . . . . . . . 3-4
The finalization section . . . . . . . . . . . . 3-5
Unit references and the uses clause . . . . . . . 3-5
The syntax of a uses clause . . . . . . . . . . 3-6
Multiple and indirect unit references . . . . 3-7
Circular unit references . . . . . . . . . . . . 3-8
Chapter 4
Syntactic elements 4-1
Fundamental syntactic elements . . . . . . . . . 4-1
Special symbols . . . . . . . . . . . . . . . . . 4-2
Identifiers . . . . . . . . . . . . . . . . . . . . 4-2
Qualified identifiers . . . . . . . . . . . . . 4-3
Reserved words . . . . . . . . . . . . . . . . . 4-3
Directives. . . . . . . . . . . . . . . . . . . . . 4-4
Numerals. . . . . . . . . . . . . . . . . . . . . 4-4
Labels . . . . . . . . . . . . . . . . . . . . . . . 4-5
Character strings . . . . . . . . . . . . . . . . 4-5
Comments and compiler directives. . . . . . . . 4-6
Expressions . . . . . . . . . . . . . . . . . . . . . 4-6
Operators. . . . . . . . . . . . . . . . . . . . . 4-6
Arithmetic operators . . . . . . . . . . . . 4-7
Boolean operators . . . . . . . . . . . . . . 4-8
Logical (bitwise) operators . . . . . . . . . 4-9
String operators . . . . . . . . . . . . . . . 4-9
Pointer operators. . . . . . . . . . . . . . 4-10
Set operators . . . . . . . . . . . . . . . . 4-11
Relational operators . . . . . . . . . . . . 4-11
Class operators . . . . . . . . . . . . . . . 4-12
The @ operator . . . . . . . . . . . . . . . 4-12
Operator precedence rules . . . . . . . . 4-13
Function calls . . . . . . . . . . . . . . . . . 4-14
Set constructors . . . . . . . . . . . . . . . . 4-14
Indexes . . . . . . . . . . . . . . . . . . . . . 4-15
Typecasts . . . . . . . . . . . . . . . . . . . . 4-15
Value typecasts. . . . . . . . . . . . . . . 4-15
Variable typecasts . . . . . . . . . . . . . 4-16
Declarations and statements. . . . . . . . . . . 4-17
Declarations . . . . . . . . . . . . . . . . . . 4-17
Hinting Directives . . . . . . . . . . . . . 4-18
Statements . . . . . . . . . . . . . . . . . . . 4-18
Simple statements . . . . . . . . . . . . . . . 4-19
Assignment statements . . . . . . . . . . 4-19
Procedure and function calls . . . . . . . 4-19
Goto statements . . . . . . . . . . . . . . 4-20
Structured statements. . . . . . . . . . . . . 4-21
Compound statements . . . . . . . . . . 4-21
With statements . . . . . . . . . . . . . . 4-22
If statements . . . . . . . . . . . . . . . . 4-23
Contents