Procedure pointer assignment (Fortran 2003)

The procedure pointer assignment statement causes a procedure pointer to become associated with a target or causes the procedure pointer's association status to become disassociated or undefined.

Read syntax diagramSkip visual syntax diagram
>>-proc_pointer_object-- => --proc_target----------------------><

proc_target
is an expression or a procedure name. If proc_target is an expression, it must be a function that returns a procedure pointer. If proc_target is a procedure name, it must be the name of an external procedure, a module procedure, a dummy procedure, an intrinsic procedure that can be passed as an actual argument, or another procedure pointer. Fortran 2008 beginsproc_target can also be the name of an internal procedure.Fortran 2008 ends proc_target must not be an elemental procedure.
proc_pointer_object
is a procedure pointer.

If proc_target is not a procedure pointer, proc_pointer_object becomes associated with proc_target. If proc_target is a procedure pointer and is associated with a procedure, proc_pointer_object becomes associated with the same procedure. If proc_target is a pointer with an association status of disassociated or undefined, proc_pointer_object acquires the same status.

If the proc_pointer_object has an explicit interface, its characteristics must be the same as proc_target except that proc_target can be pure even if proc_pointer_object is not. If the characteristics of proc_pointer_object or proc_target are such that an explicit interface is required, both proc_pointer_object and proc_target must have an explicit interface.

If proc_pointer_object has an implicit interface and is explicitly typed or referenced as a function, proc_target must be a function. If proc_pointer_object has an implicit interface and is referenced as a subroutine, proc_target must be a subroutine.

If proc_target and proc_pointer_object are functions, they must have the same type; corresponding type parameters must either be both deferred or have the same value.

If proc_target is a specific procedure name that is also a generic name, only the specific procedure is associated with proc_pointer_object.



Voice your opinion on getting help information Ask IBM compiler experts a technical question in the IBM XL compilers forum Reach out to us