%VAL

Built-in Function: Changes the form of an actual argument. Passes the argument as an immediate value.

Syntax

%VAL (a)

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

The argument is passed as follows:

You must specify %VAL 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 %VAL:

Actual Argument Data Type Default %VAL
Expressions:
Logical REF Yes1
Integer REF Yes1
REAL(4) REF Yes
REAL(8) REF Yes2
REAL(16) REF No
COMPLEX(4) REF Yes
COMPLEX(8) REF Yes
COMPLEX(16) REF No
Character See table note3 No
Hollerith REF No
Aggregate4 REF No
Derived REF No
Array Name:
Numeric REF No
Character See table note3 No
Aggregate4 REF No
Derived REF No
Procedure Name:
Numeric REF No
Character See table note3 No
1 If a logical or integer value occupies less than 64 bits of storage on Intel® 64 and IA-64 architectures, or 32 bits of storage on IA-32 architecture, it is converted to the correct size by sign extension. Use the ZEXT intrinsic function if zero extension is desired.
2 i64 only
3 A character argument is passed by address and hidden length.
4 In Intel Fortran record structures

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

See Also

CALL, %REF, %LOC

Example

  CALL SUB(2, %VAL(2))

Constant 2 is passed by reference. The second constant 2 is passed by immediate value.