This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PROCEDURE declarations


Hi all!


A small followup:

Tobias Burnus wrote:
> "module procedure" may only be used in generic interfaces,
Better interfaces with generic spec; they have either a generic name as
my examples had,  "interface operator(.myOp.)" or "interface assignment(=)".


> "MODULE PROCEDURE" may only refer to a (host-associated) module procedure
>   
Use-associated module procedures are also allowed.



For completeness:

PROCEDURE([type]) [[, attributes] :: ] name

Defines external procedures or dummy procedures (i.e. interface of a
function/subroutine argument arguments) and can appear in PROGRAM, in
the specification part of a MODULE (i.e. the part of a module which
comes before CONTAINS) and in functions/subroutines (whether they are
part of a module or not).

It is an extended version of EXTERNAL and saves one from repeatedly
typing the interface of procedures which have the same interface.


In generic INTERFACES:

[MODULE ] PROCEDURE name

Imports a procedure with a *known* interface into that generic
INTERFACE; the interface of the procedure must be explicitly known; for
"module procedure" it must be a host- or use-associated procedure; for
"PROCEDURE" it may also be an external procedure where the interface is
explicitly known [defined by an INTERFACE block or by PROCEDURE (but not
"PROCEDURE(REAL)" or "PROCEDURE()" or "EXTERNAL")] or an dummy procedure
(= argument to a subroutine/function).



In TYPE there one can also have PROCEDURE but this requires the
attribute POINTER:

PROCEDURE([type]) [, attributes :: ] name

and I would suggest to defer this until you start with procedure pointers.


Tobias


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]