Pointer Types [ HP Pascal/iX Reference Manual ] MPE/iX 5.0 Documentation
HP Pascal/iX Reference Manual
Pointer Types
Pointers
A pointer is a data type that may reference any type, including type
FILE. A pointer references a dynamically allocated variable on the heap.
The pointer type consists of the caret (^) and a type identifier. The @
symbol may replace the caret.
The type appearing after the caret need not be previously defined. This
is an exception to the general rule that HP Pascal identifiers are first
defined and then used. However, the identifier after the caret must be
defined within the same declaration part.
A type identifier used in a pointer type declaration in an EXPORT section
need not be defined until the IMPLEMENT section. A pointer declared in
this manner cannot be dereferenced in modules that IMPORT the pointer
type.
The pointer value NIL belongs to every pointer type. NIL points to no
variable on the heap. For more information, refer to the section on NIL
in this chapter.
Syntax
Pointer_type:
Permissible Operators
assignment :=
equality =, <>
Standard Procedures
pointer parameters - new
dispose
mark
release
Example
TYPE
ptr1 = ^rec1;
ptr2 = ^rec2;
rec1 = RECORD
f1, f2: integer;
link: ptr2;
END;
rec2 = RECORD
f1, f2: real;
link: ptr1;
END;
MPE/iX 5.0 Documentation