- 2.2.7.4 -
TMT Pascal Language Description
Pascal Language Structure
DeclarationsVariable Declarations
Variables store data during program execution. A variable declaration is
preceded by the var reserved word.
var identifier [,identifier]: Identifiertype;
Identifier is the actual name of the variable defined.
Identifiertype specifies the type of the variable. Variables, unlike
constants, are not initialized. Their content prior to initialization is
undefined. It is also possible to specify the absolute address of a variable.
Following the Identifiertype specify the Absolute reserved word.
var identifier [,identifier]: Identifiertype absolute address;
Address may be either an identifier or an integer number indicating an
offset. If Address is an identifier then TMT Pascal computes it's offset.
Absolute maps the variable to the address following the Absolute
statement. This identifier must be declared prior to using Absolute.
If a variable is the absolute of another, both address the same data however
the types may be different.
The following are examples of variable declarations.
const
BuffSize = 900000; // 900K
var
HugeBuff : array [0..BuffSize] of Char;
i,j,k,l : Integer;
Buffptr : Longint;
p : Pointer absolute Buffptr;
Alpha : Char;
The absolute may refer to fields of records and objects. Also, the address of
a global record/object field can be used within the initialization of typed
constants. Furthermore one can use recursive initialization:
type
rec = record
next: ^rec;
buffer: array [1..10] of char;
buf_adr: pointer;
end;
const
cyclic: rec = (next: @cyclic; buf_adr: @cyclic.buffer);
|
|
|
Constant Declarations |
Table of Content |
Local Block Declarations |
- 2.2.7.4 -