Developer Guide and Reference

ID 767251
Date 10/31/2024
Public
Document Table of Contents

%REF

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

%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 Intel® 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)

REF

Yes

COMPLEX(4)

REF

Yes

COMPLEX(8)

REF

Yes

COMPLEX(16)

REF

Yes

Character

See table note 1

Yes

Hollerith

REF

No

Aggregate2

REF

Yes

Derived

REF

Yes

Array Name:

Numeric

REF

Yes

Character

See table note 1

Yes

Aggregate2

REF

Yes

Derived

REF

Yes

Procedure Name:

Numeric

REF

Yes

Character

See table note 1

Yes

1 A character argument is passed by address and hidden length.

2 In Intel® Fortran record structures

The %REF and %VAL functions override related !DIR$ ATTRIBUTE settings.

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, compiler option iface determines how the character argument for variable B is passed.