Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 7/13/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

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

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

2In 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.