Contents | Prev | Next | Index


Address Operator

The address operator @ is used in an address factor to compute the address of a variable, procedure or function.

primary           ::= @ expr_designator
expr_designator ::= designator ::= func_var_ref func_var_ref ::= func_result selector_list func_result ::= proc_designator actual_parameters

The @ operator returns the address of its operand, that is, it constructs a pointer value that points to the operand. The @ operator does exactly the same as the standard function ADDR.

When applied to a variable, @ returns a pointer to the variable. The type of the resulting pointer always is POINTER. This is the untyped pointer, which is compatible with all other pointer types. Special rules apply to the use of the @ operator with a procedural variable, see the section under procedural expressions.

Notice that, unlike other Pascal compilers, Canterbury Pascal always maps pointers to Java reference types, which are pointers to structured types only. Because of this, the variable must be of a structured type, such as a record, class, array, file type or set type. And pointer typecasts are subject to strict Java runtime checks, which is like an internal IS-relation.

The @ operator can also be applied to a procedure or function to produce a pointer to the rountine's entry point. The resulting pointer always is the untyped POINTER. This compiler maps procedure or function pointer to the Java class java.lang.reflect.Method.

Unlike Borland Pascal, Canterbury Pascal does not support the @ operator for methods.


Contents | Prev | Next | Index

Canterbury Pascal for JVM  (Last documentation update Sep 02, 2004)
Copyright © 1999-2004 J.Neuhoff - mhccorp.com  . All rights reserved.
Please send any comments or corrections to neuhoff@mhccorp.com