Next: Duplicate Arguments
Up: Arguments of External Procedures
Previous: Arguments of External Procedures
The actual arguments of the function reference or CALL statement
become associated with the corresponding dummy arguments of
the FUNCTION or SUBROUTINE statement. The main rules are
as follows:
- There must be the same number of actual and dummy
arguments; they are associated solely by their position in
the two lists. Optional arguments are not permitted in
Fortran77.
- If the dummy argument is a variable, array, or procedure
used as a function then the corresponding actual
argument must have the same data type.
- If the dummy argument is an array then its array bounds
must not be larger than those of the corresponding actual
argument. Alternatively the dimension bounds of a
dummy array can be passed in by means of other
procedure arguments to form an adjustable. This option
and the assumed-size array are both described in section
9.6.
- If the dummy argument is a character item then its
length must not be greater than that of the corresponding
actual argument. Alternatively there is a passed-length
option for character arguments: see section 9.5.
Because program units are compiled independently, it is difficult
for the compiler to check for mismatches in actual and dummy
argument lists. Although mismatches could, in principle, be
detected by the linker, this rarely seems to happen in practice.
Errors, particularly mismatches of data type or array bounds, are
especially easy to make but hard to detect. Sometimes the only
indication is that the program produces the wrong answer. This
shows how important it is to check procedure interfaces.
Next: Duplicate Arguments
Up: Arguments of External Procedures
Previous: Arguments of External Procedures
Helen Rowlands
8/27/1998