Built-in Function: Changes the form of an actual argument. Passes the argument as an immediate value.
Syntax
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 Compaq 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) 3 | REF | No |
COMPLEX(4) | REF | Yes |
COMPLEX(8) | REF | Yes |
COMPLEX(16) 3 | REF | No |
Character | See table note4 | No |
Hollerith | REF | No |
Aggregate5 | REF | No |
Derived | REF | No |
Array Name: | ||
Numeric | REF | No |
Character | See table note4 | No |
Aggregate5 | REF | No |
Derived | REF | No |
Procedure Name: | ||
Numeric | REF | No |
Character | See table note4 | No |
1 If a logical or integer value occupies less
than 64 (Alpha and ia64 processors) or 32 (ia32 processors) bits of storage, it is converted to the
correct size by sign extension. Use the ZEXT intrinsic function
if zero extension is desired.
2 Alpha only 3 VMS, U*X 4 On Windows, Tru64 UNIX, and Linux systems, a character argument is passed by address and hidden length. 5 In Compaq Fortran record structures |
The %VAL, %REF, and %DESCR functions override related cDEC$ ATTRIBUTE settings.
Example
CALL SUB(2, %VAL(2))
Constant 2 is passed by reference. The second constant 2 is passed by immediate value.