Quick start manual

iv
Case statements . . . . . . . . . . . . . . .4-25
Control loops . . . . . . . . . . . . . . . . 4-27
Repeat statements. . . . . . . . . . . . . .4-27
While statements . . . . . . . . . . . . . .4-27
For statements. . . . . . . . . . . . . . . . 4-28
Blocks and scope . . . . . . . . . . . . . . . . . . 4-29
Blocks . . . . . . . . . . . . . . . . . . . . . .4-30
Scope. . . . . . . . . . . . . . . . . . . . . . . 4-30
Naming conflicts . . . . . . . . . . . . . .4-31
Chapter 5
Data types, variables, and constants 5-1
About types. . . . . . . . . . . . . . . . . . . . . 5-1
Simple types . . . . . . . . . . . . . . . . . . . . 5-3
Ordinal types . . . . . . . . . . . . . . . . . . 5-3
Integer types. . . . . . . . . . . . . . . . . 5-4
Character types . . . . . . . . . . . . . . . 5-5
Boolean types . . . . . . . . . . . . . . . . 5-6
Enumerated types . . . . . . . . . . . . . 5-6
Subrange types . . . . . . . . . . . . . . . 5-8
Real types . . . . . . . . . . . . . . . . . . . .5-10
String types . . . . . . . . . . . . . . . . . . . . . 5-11
Short strings. . . . . . . . . . . . . . . . . . .5-12
Long strings. . . . . . . . . . . . . . . . . . .5-13
WideString . . . . . . . . . . . . . . . . . . .5-13
About extended character sets . . . . . .5-13
Working with null-terminated strings . . . . 5-14
Using pointers, arrays,
and string constants . . . . . . . . . . .5-14
Mixing Delphi strings
and null-terminated strings . . . . . . . 5-16
Structured types . . . . . . . . . . . . . . . . . .5-17
Sets . . . . . . . . . . . . . . . . . . . . . . . .5-18
Arrays . . . . . . . . . . . . . . . . . . . . . . 5-19
Static arrays . . . . . . . . . . . . . . . . .5-19
Dynamic arrays . . . . . . . . . . . . . . . 5-20
Array types and assignments . . . . . . .5-22
Records . . . . . . . . . . . . . . . . . . . . .5-23
Variant parts in records . . . . . . . . . . 5-24
File types . . . . . . . . . . . . . . . . . . . .5-26
Pointers and pointer types . . . . . . . . . . . .5-27
Overview of pointers . . . . . . . . . . . . .5-27
Pointer types . . . . . . . . . . . . . . . . . . 5-29
Character pointers . . . . . . . . . . . . .5-29
Type-checked pointers . . . . . . . . . . . 5-29
Other standard pointer types . . . . . . .5-29
Procedural types . . . . . . . . . . . . . . . . . 5-30
Procedural types in statements
and expressions . . . . . . . . . . . . . . . 5-32
Variant types. . . . . . . . . . . . . . . . . . . . 5-33
Variant type conversions . . . . . . . . . . . 5-34
Variants in expressions . . . . . . . . . . . . 5-35
Variant arrays . . . . . . . . . . . . . . . . . 5-36
OleVariant . . . . . . . . . . . . . . . . . . . 5-36
Type compatibility and identity . . . . . . . . . 5-37
Type identity . . . . . . . . . . . . . . . . . . 5-37
Type compatibility . . . . . . . . . . . . . . 5-38
Assignment-compatibility . . . . . . . . . . 5-38
Declaring types . . . . . . . . . . . . . . . . . . 5-39
Variables . . . . . . . . . . . . . . . . . . . . . . 5-40
Declaring variables . . . . . . . . . . . . . . 5-40
Absolute addresses . . . . . . . . . . . . 5-41
Dynamic variables . . . . . . . . . . . . . 5-42
Thread-local variables . . . . . . . . . . . 5-42
Declared constants . . . . . . . . . . . . . . . . 5-42
True constants . . . . . . . . . . . . . . . . . 5-43
Constant expressions . . . . . . . . . . . 5-44
Resource strings . . . . . . . . . . . . . . 5-45
Typed constants . . . . . . . . . . . . . . . . 5-45
Array constants . . . . . . . . . . . . . . 5-45
Record constants . . . . . . . . . . . . . . 5-46
Procedural constants . . . . . . . . . . . 5-46
Pointer constants. . . . . . . . . . . . . . 5-47
Chapter 6
Procedures and functions 6-1
Declaring procedures and functions . . . . . . . 6-2
Procedure declarations . . . . . . . . . . . . . 6-2
Function declarations . . . . . . . . . . . . . . 6-3
Calling conventions . . . . . . . . . . . . . . . 6-5
Forward and interface declarations . . . . . . 6-6
External declarations . . . . . . . . . . . . . . 6-6
Linking to object files . . . . . . . . . . . . 6-7
Importing functions from libraries. . . . . 6-7
Overloading procedures and functions . . . . 6-8
Local declarations . . . . . . . . . . . . . . . 6-11
Nested routines . . . . . . . . . . . . . . 6-11
Parameters . . . . . . . . . . . . . . . . . . . . . 6-11
Parameter semantics . . . . . . . . . . . . . 6-12
Value and variable parameters . . . . . . 6-12
Constant parameters . . . . . . . . . . . 6-13
Out parameters. . . . . . . . . . . . . . . 6-14
Untyped parameters. . . . . . . . . . . . 6-14