Language:
Русский
English
Pointer-type constants
The declaration of a pointer-type constant typically uses a constant address expression to specify the pointer value.
When you enable the extended syntax (with a {$X+} compiler directive), a typed constant of type PChar can be initialized with a string constant.
Examples
type
Direction = (Left, Right, Up, Down);
StringPtr = ^String;
NodePtr = ^Node;
Node = record
Next: NodePtr;
Symbol: StringPtr;
Value: Direction;
end;
const
S1: string[4] = 'DOWN';
S2: string[2] = 'UP';
S3: string[5] = 'RIGHT';
S4: string[4] = 'LEFT';
N1: Node = (Next: nil; Symbol: @S1; Value: Down);
N2: Node = (Next: @N1; Symbol: @S2; Value: Up);
N3: Node = (Next: @N2; Symbol: @S3; Value: Right);
N4: Node = (Next: @N3; Symbol: @S4; Value: Left);
DirectionTable: NodePtr = @N4;