%REF

Built-in Function: Changes the form of an actual argument. Passes the argument by reference. In Visual Fortran, passing by reference is the default.

Syntax

result = %REF (a)

a
(Input) An expression, record name, procedure name, array, character array section, or array element.

You must specify %REF in the actual argument list of a CALL statement or function reference. You cannot use it in any other context.

The following table lists the Compaq Fortran defaults for argument passing, and the allowed uses of %REF:

Actual Argument Data Type Default %REF
Expressions:
Logical REF Yes
Integer REF Yes
REAL(4) REF Yes
REAL(8) REF Yes
REAL(16) 1 REF Yes
COMPLEX(4) REF Yes
COMPLEX(8) REF Yes
COMPLEX(16) 1 REF Yes
Character See table note 2 Yes
Hollerith REF No
Aggregate 3 REF Yes
Derived REF Yes
Array Name:
Numeric REF Yes
Character See table note 2 Yes
Aggregate 3 REF Yes
Derived REF Yes
Procedure Name:
Numeric REF Yes
Character See table note 2 Yes
1 VMS, U*X
2 On Tru64 UNIX, Linux, and Windows systems, a character argument is passed by address and hidden length.
3 In Compaq Fortran record structures

The %REF, %VAL, and %DESCR functions override related cDEC$ ATTRIBUTE settings.

See Also: CALL, %VAL, %DESCR

Example

  CHARACTER(LEN=10) A, B
  CALL SUB(A, %REF(B))

Variable A is passed by address and hidden length. Variable B is passed by reference.

Note that on Windows systems, the option /iface determines how the character argument for variable B is passed.