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


Ok, I think I need some clarification on how to interpret the Fortran
2003 standard. In section 12.3.2.1 we find:


R1206   procedure-stmt    is    [ MODULE ] PROCEDURE procedure-name-list

C1207 (R1206) A procedure-name shall have an explicit interface and
shall refer to an accessible procedure pointer, external procedure,
dummy procedure, or module procedure.

C1208 (R1206) If MODULE appears in a procedure-stmt, each
procedure-name in that statement shall be accessible in the current
scope as a module procedure.


So if I define a procedure in a program, I suppose the standard says
the procedure must be external, and forbids this:

program x
procedure(real):: proc
contains
  real function proc
    proc=3.0
  end function
end program

Is that right?
Now, for a module, can I do the following, or is it also forbidden?

module x
procedure(real):: proc
contains
 real function proc
    proc=3.0
  end function
end module

Or is the correct syntax like this:

module x
module procedure(real):: proc
contains
 real function proc
    proc=3.0
  end function
end module

I'm just a little confused right now. Which of these three examples is
valid Fortran 2003 and which is not?
Janus


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