>>-+------------------+--+-argument------------------+--------->< '-arg_keyword-- = -' | (1) | +-%VAL--(--argument-------)-+ | (2) | '-%REF--(--argument-------)-'
Notes:
|
+-------------------------------IBM Extension--------------------------------+
+----------------------------End of IBM Extension----------------------------+
An actual argument appears in the argument list of a procedure reference. An actual argument in a procedure reference can be one of the following:
An actual argument specified in a statement function reference must be a scalar object.
A procedure name cannot be the name of an internal procedure, statement function, or the generic name of a procedure, unless it is also a specific name.
The rules and restrictions for referencing a procedure described in Procedure References.
You cannot use a non-intrinsic elemental procedure as an actual
argument in Fortran 95.
Argument keywords allow you to specify actual arguments in a different order than the dummy arguments. With argument keywords, any actual arguments that correspond to optional dummy arguments can be omitted; that is, dummy arguments that merely serve as placeholders are not necessary.
Each argument keyword must be the name of a dummy argument in the explicit interface of the procedure being referenced. An argument keyword must not appear in an argument list of a procedure that has an implicit interface.
In the argument list, if an actual argument is specified with an argument keyword, the subsequent actual arguments in the list must also be specified with argument keywords.
An argument keyword cannot be specified for label parameters. Label parameters must appear before referencing the argument keywords in that procedure reference.
INTEGER MYARRAY(1:10) INTERFACE SUBROUTINE SORT(ARRAY, DESCENDING, ARRAY_SIZE) INTEGER ARRAY_SIZE, ARRAY(ARRAY_SIZE) LOGICAL, OPTIONAL :: DESCENDING END SUBROUTINE END INTERFACE CALL SORT(MYARRAY, ARRAY_SIZE=10) ! No actual argument corresponds to the ! optional dummy argument DESCENDING END SUBROUTINE SORT(ARRAY, DESCENDING, ARRAY_SIZE) INTEGER ARRAY_SIZE, ARRAY(ARRAY_SIZE) LOGICAL, OPTIONAL :: DESCENDING IF (PRESENT(DESCENDING)) THEN . . . END SUBROUTINE
>>-+-dummy_arg_name------------------+------------------------->< | (1) | +-%VAL-------(--dummy_arg_name--)-+ | (2) | '-%REF-------(--dummy_arg_name--)-'
Notes:
|
A dummy argument is specified in a Statement Function statement, FUNCTION statement, SUBROUTINE statement, or ENTRY statement. Dummy arguments in statement functions, function subprograms, interface bodies, and subroutine subprograms indicate the types of actual arguments and whether each argument is a scalar value, array, procedure, or statement label. A dummy argument in an external, module, or internal subprogram definition, or in an interface body, is classified as one of the following:
+-------------------------------IBM Extension--------------------------------+
%VAL or %REF can only be specified for a dummy argument in a FUNCTION or SUBROUTINE statement in an interface block. The interface must be for a non-Fortran procedure interface. If %VAL or %REF appears in an interface block for an external procedure, this passing method is implied for each reference to that procedure. If an actual argument in an external procedure reference specifies %VAL or %REF, the same passing method must be specified in the interface block for the corresponding dummy argument. See %VAL and %REF for more details.
+----------------------------End of IBM Extension----------------------------+
A dummy argument in a statement function definition is classified as a variable name.
A given name can appear only once in a dummy argument list.
The name of a variable that appears as a dummy argument in a statement function statement has a scope of the statement in which it appears. It has the type that it would have if it were the name of a variable in the scoping unit that includes the statement function. It cannot have the same name as an accessible array.