Developer Guide and Reference

ID 767251
Date 10/31/2024
Public
Document Table of Contents

Dummy Procedure Arguments

If an actual argument is a procedure, its corresponding dummy argument is a dummy procedure or a procedure pointer. Dummy procedures can appear in function or subroutine subprograms.

The actual argument must be the specific name of an external, module, intrinsic, a procedure pointer, or another dummy procedure. If the specific name is also a generic name, only the specific name is associated with the dummy argument. Not all specific intrinsic procedures can appear as actual arguments. (For more information, see table Specific Functions Not Allowed as Actual Arguments in Intrinsic Procedures.) Specific names for intrinsic functions are an obsolescent feature in the Fortran standard.

The actual argument and corresponding dummy procedure must both be subroutines or both be functions.

If the interface of the dummy procedure is explicit, the type and kind parameters, and rank of the associated actual procedure must be the same as that of the dummy procedure.

If the interface of the dummy procedure is implicit and the procedure is referenced as a subroutine, the actual argument must be a subroutine, a procedure pointer associated with a subroutine, or a dummy procedure.

If the interface of the dummy procedure is implicit and the procedure is referenced as a function or is explicitly typed, the actual argument must be a function, a procedure pointer associated with a function, or a dummy procedure.

Dummy procedures can be declared optional, but they must not be declared with an intent.

The following is an example of a procedure used as an argument:

  REAL FUNCTION LGFUNC(BAR)
    INTERFACE
      REAL FUNCTION BAR(Y)
        REAL, INTENT(IN) :: Y
      END
    END INTERFACE
    ...
    LGFUNC = BAR(2.0)
    ...
  END FUNCTION LGFUNC

See Also