Functions And Subroutines

FORTRAN-80

NOTE

The subscript value remains constant as long as the arguments are associated, even if the subscript contains variables redefined during the association.

Argument association can be carried through more than one level of procedure reference. A valid association exists at the last level, however, only if the association is maintained through all intermediate levels. The association normally terminates when a RETURN or END is executed. The association is not retained from one pro- cedure reference to the next.

5.3.3.1 Agreement Of Argument Lengths

If a dummy argument is type character, its actual argument must be the same type and length. If the dummy is an array name, the length requirement applies to each element in the array.

Ifthe dllmmy argumentis type integer. the arguments must again agreeiu type and lepgth~lfaninteger c()nstant is used as an actual argument, its length is deterInined as shq""n in~ection 2.2.Z.2.That is, an integer without abas~suffix has the default integer variable length;if the base of the integer constantisstated explicitly, tbe pro-

c~ssordetermines its length implicitly.

5.3.3.2 Variables As Dummy Arguments

A variable dummy argument can be associated with an actual variable, array ele- ment, or expression. If the actual argument is a variable name or array element name, its dummy argument can be defined or redefined within the subprogram. Otherwise, if the actual argument is a constant, function reference, or expression, its dummy argument must not be redefined within the subprogram.

5.3.3.3 Arrays As Dummy Arguments

An array dummy argument can be associated with an actual array name or array ele- ment name. The number and size of dimensions in an actual argument array declarator can be differept from the dimensions in its associated dummy array declarator.

If the actual argument is an array name, the size of the dummy argument array must not be greater than the size of the actual argument array.

If the actual argument is an array element name with a subscript 'p,' the dummy ar- ray element with a subscript 'q' becomes associated with the actual array element with the subscript value (p + q-l). The size of the dummy array must not be greater than the size of the actual array plus one minus the subscript value of the array ele- ment.

5.3.3.4 Procedures As Dummy Arguments

If a dummy argument is used as if it were an external function, the associated actual argument must be an intrinsic function, external function, or dummy procedure. If a dummy argument appears in a type statement and an EXTERNAL statement, the actual argument must be the name of a function or dummy procedure. If the dummy argument is referenced as a subroutine, the actual argument must be the name of a subroutine or dummy procedure and must not appear in a type statement or be referenced as a function.

5-10

Page 58
Image 58
Intel fortran-80 manual Agreement Of Argument Lengths