This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: PROCEDURE declarations
- From: "Janus Weil" <jaydub66 at googlemail dot com>
- To: "Tobias Burnus" <burnus at net-b dot de>
- Cc: "fortran at gcc dot gnu dot org" <fortran at gcc dot gnu dot org>
- Date: Mon, 20 Aug 2007 15:42:59 +0200
- Subject: Re: PROCEDURE declarations
- Dkim-signature: a=rsa-sha1; c=relaxed/relaxed; d=googlemail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=plsW6BSzlU4pmu411qlhfUCsOzN5kLQbzMO0dG389cpP8APz67hnhumEBzUkI/Wzn3ySBWzJ9skgXoU1MDfnb2IdIgi0vBAj89t05coOFztRiNwOuhEGsPveJ9JcoROSkrxZbmuc6Z2Ij8SBQQ8+8BkonpebtrVaMJRFvLCoBq0=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=Sn6qWWQV1GbGfCz1MLAR+i7WwYXOn0UpGZdvAS/z9XDpcZ36pk0Qmg55mT8sKs3A546PKeTLQCTZDV4e1QE0o4gkFepGmTFRnFVQl0Qx2/HhgFfsalAzuv6Ed4fqXiinE9h4uGV6vaDO4clSDgJDJflZpMx1wkhoArmbdYnLk2o=
- References: <854832d40708190539x403a99fcs23363e0ff7fd5e3b@mail.gmail.com> <46C8B29B.3070204@net-b.de>
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