8.8.9.1 %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 and ia64 processors; 32 on ia32 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 
Expressions:
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  Yes  Yes  Yes 
COMPLEX(8)  REF  Yes  Yes  Yes 
COMPLEX(16) 4  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 and ia64) or 32 (ia32) 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, Linux, and Windows 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

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

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