Intel® Fortran Compiler 16.0 User and Reference Guide
A component of derived type can be a procedure pointer. A procedure pointer component definition takes the following form:
PROCEDURE ([ proc-interface ]), proc-attr [, proc-attr]... :: proc-decl-list
(Optional) Is the name of an interface or a type specifier.
Is one of the following attributes:
PUBLIC
PRIVATE
POINTER (required)
NOPASS or PASS [ (arg-name) ]
where arg-name is the name of a dummy argument.
PASS and NOPASS refer to passed-object dummy arguments. They are mutually exclusive. You can only specify one or the other in a proc-attr list, not both.
If you specify NOPASS, procedures will not have have passed-object dummy arguments. NOPASS is required if the interface is implicit.
The PASS attribute can be used to confirm the default (as the first argument), The NOPASS attribute prevents passing the object as an argument.
Each proc-attr can only appear once in a given component definition.
Is one or more of the following:
procedure-name [=> null-init]
where null-init is a reference to intrinsic function NULL with no arguments.
If => null-init appears, the procedure must have the POINTER attribute.
The following example defines a type that represents a list of procedures with the same interface, which can be called at some future time:
TYPE PROCEDURE_LIST PROCEDURE (PROC_INTERFACE), POINTER :: PROC TYPE (PROCEDURE_LIST), POINTER :: NEXT => NULL() END TYPE PROCEDURE_LIST ABSTRACT INTERFACE SUBROUTINE PROC_INTERFACE ... END SUBROUTINE PROC_INTERFACE END INTERFACE
A procedure pointer can be pointer-assigned to a procedure pointer variable, invoked directly, or passed as an actual argument. For example:
TYPE (PROCEDURE_LIST) :: a, b(6) PROCEDURE (PROC_INTERFACE), POINTER :: R ... R => a%PROC CALL SUBROUTINE_NEXT(a%PROC) CALL b(i)%PROC