Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 6/24/2024
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

Passed-Object Dummy Arguments

A procedure component or a binding procedure (type-bound procedure) can be declared to have a passed-object dummy argument. This kind of argument is associated with a special actual argument, which is not explicitly written in the actual argument list. The appropriate actual argument is then added to the argument list.

A passed-object dummy argument must be a scalar. It must not be a pointer, must not be allocatable, and all its length type parameters must be assumed. Its declared type must be the type in which the component or binding procedure appears.

The determination of the passed-object dummy argument depends on the following:

  • The PASS and NOPASS attributes specified or in effect

  • The interface of the procedure component or binding procedure

The following rules apply to PASS and NOPASS:

  • PASS and NOPASS are mutually exclusive. You can only specify one of these attributes for the same procedure component or binding.

  • If you specify PASS (arg-name), dummy argument arg-name is the passed-object dummy argument. The interface of the procedure pointer component or binding procedure must have a dummy argument named arg-name.

  • If NOPASS is specified, there is no passed-object dummy argument.

  • NOPASS must be specified if the procedure component or binding procedure has an implicit interface.

  • If you do not specify PASS or NOPASS, or you specify PASS without arg-name, the first dummy argument of a procedure pointer component or binding procedure is the passed-object dummy argument. In this case, there must be at least one dummy argument.

The following shows an example of a passed-object dummy argument:

TYPE my_type
  INTEGER  :: count
  PROCEDURE(abs_iface),POINTER, PASS (me) :: proc_ptr
END TYPE
ABSTRACT INTERFACE
  SUBROUTINE abs_iface (da, me)
    IMPORT my_type
    REAL           :: da
    CLASS(my_type) :: me
  END SUBROUTINE
END INTERFACE
. . . 
TYPE (my_type) :: var
my_var => my_subroutine
CALL my_var%proc_ptr (100.0)

The above call statement is the same as CALL my_subroutine (100.0, var).