HP 3000 Manuals

Parameter Passing Methods [ HP FORTRAN 77/iX Reference ] MPE/iX 5.0 Documentation


HP FORTRAN 77/iX Reference

Parameter Passing Methods 

All arguments of a subprogram written in FORTRAN are passed by reference,
except for character variables, which are passed by descriptor.  This
means that the addresses of the values are passed instead of the actual
values of the arguments.  Therefore, a FORTRAN subprogram expects a list
of addresses for the formal arguments passed to it (for character
variables, FORTRAN expects an address and a length), one for each
argument and in the order given by the formal argument list contained
within the subprogram.

Although values are normally passed by reference (indirectly), they can
be passed by value (directly) to invoke non-FORTRAN program units that
allow passing arguments by value.  To accomplish this, use the ALIAS
compiler directive to indicate how each of the parameters is to be
passed.  The language option of the ALIAS directive can also indicate the
language of the routine being called so the compiler can pass arguments
to the routine in the manner expected.  For example, in Pascal, when a
formal parameter is a PAC variable (PACKED ARRAY[1..n] OF CHAR), only a
pointer to the variable is expected.  However, FORTRAN 77 also passes the
length of the character variable.  If you indicate with the ALIAS
directive that the routine being called is a Pascal routine, FORTRAN 77
will not pass the length of the character variable.

FORTRAN does not allow arrays to be passed by value.  It is not possible
to interface a FORTRAN program to a non-FORTRAN program unit that
requires an array parameter to be passed by value.

Also, as in calling FORTRAN functions that have no parameters, an empty
parameter list, ( ), must be given when referencing any non-FORTRAN
function that has no parameters.



MPE/iX 5.0 Documentation