[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
var variable name: data type absolute variable reference; |
var variable name: data type absolute integer expression; |
The first meaning of the `absolute' directive allows to put a variable to the address of another one and thus provides a type-casting mechanism.
In most cases, variable reference will be just a variable name, but GPC also allows arbitrary pointer expressions here. If variable reference has neither a constant address nor is a variable parameter, GPC prints a warning. This warning is suppressed in "extended syntax" mode which is switched on by the `--extended-syntax' option or the `{$X+}' compiler directive.
GPC also allows explicit type casts. Variant records (as defined in ISO-7185 Pascal), however, have no guaranteed overlaying and are therefore not suitable for type casts.
The second meaning of `absolute' places a variable at a specified address. This is useful on machines without virtual memory addressing for doing certain low-level operations, but should be avoided on systems with memory protection such as Unix-like systems. GPC does not check whether the specified virtual address makes any sense and does not provide a built-in mechanism to map it to a real address.
GPC warns about this second use of `absolute' unless "extended syntax" has been requested.
`absolute' is a Borland Pascal extension.
Borland Pascal has a slightly different syntax for the second meaning related to the addressing scheme of IA32 processors working in real mode.
Allowing arbitrary memory references instead of just variable names in the first meaning of `absolute' is a GNU Pascal extension.
program AbsoluteDemo; |
section 9.222 record, section 8.7 Type Casts.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |