%DESCR (VMS only), %REF, and %VAL Argument List Functions

When a procedure is called, Fortran (by default) passes the address of the actual argument, and its length if it is of type character. To call non-Fortran procedures, you may need to pass the actual arguments in a form different from that used by Fortran.

The built-in functions %DESCR, %REF, and %VAL let you change the form of an actual argument. You must specify these functions in the actual argument list of a CALL statement or function reference. You cannot use them in any other context.

These functions specify how to pass an actual argument (for example, a) to a non-Fortran procedure, as follows:

Function  Effect 
%VAL (a)  Passes argument a as an n-bit [1] immediate value. If a is integer (or logical) and shorter than n bits, it is sign-extended to an n-bit value. For complex data types, %VAL passes two n-bit arguments. 
%REF (a)  Passes argument a by reference. 
%DESCR (a)  Passes argument a by descriptor. (VMS only) 

[1] n is 64 on Alpha processors; 32 on Intel processors.

Table 8-1 lists the Compaq Fortran defaults for argument passing, and the allowed uses of %DESCR, %REF, and %VAL.

Table 8-1 Defaults for Argument List Functions

    Allowed Functions
Actual Argument Data Type  Default  %VAL  %REF   %DESCR [1] 
Logical  REF  Yes[2]  Yes  Yes 
Integer  REF  Yes[2]  Yes  Yes 
REAL(4)  REF  Yes  Yes  Yes 
REAL(8)  REF  Yes[3]  Yes  Yes 
REAL(16)[4]  REF  No  Yes  Yes 
COMPLEX(4)  REF  No  Yes  Yes 
COMPLEX(8)  REF  No  Yes  Yes 
Character  DESCR[1,5]  No  Yes  Yes 
Hollerith  REF  No  No  No 
Aggregate[6]  REF  No  Yes  No 
Derived  REF  No  Yes  No 
Array Name:
Numeric  REF  No  Yes  Yes 
Character  DESCR[1,5]  No  Yes  Yes 
Aggregate[6]  REF  No  Yes  No 
Derived  REF  No Yes  No 
Procedure Name:
Numeric  REF  No  Yes Yes 
Character  DESCR[1,5]  No  Yes  Yes 

[1] VMS only
[2] If a logical or integer value occupies less than 64 (Alpha) or 32 (x86) bits of storage, it is converted to the correct size by sign extension. Use the ZEXT function if zero extension is desired.
[3] Alpha only
[4] VMS, U*X
[5] On Tru64 UNIX, Windows NT, and Windows 9* systems, a character argument is passed by address and hidden length. (For more information, see your user manual or programmer's guide.)
[6] In Compaq Fortran record structures

For More Information:

For details on how to use the %VAL, %REF, and %DESCR functions, see your user manual or programmer's guide.

Previous Page Next Page Table of Contents