Re: Fortran 2003 questions



"Tobias Burnus" <burnus@xxxxxxxx> wrote in message
news:d09eca25-3555-41d9-b2fb-3a25c3527795@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On May 25, 10:49 am, "jaydu...@xxxxxxxxx" <jaydu...@xxxxxxxxxxxxxx>
wrote:
"An interface body in a generic or speci?c interface block speci?es
the EXTERNAL attribute and an explicit speci?c interface for an
external procedure or a dummy procedure."

Regarding EXTERNAL I have an additional question: Is the following
valid or not?

EXTERNAL func
REAL, DIMENSION(2) :: func

I believe it is valid as neither Janus nor I could find a restriction
in the Fortran 95 or 2003 standard, even though all compilers I tried
reject it.

The following related is however definitely invalid

EXTERNAL func
REAL :: func(2)

as F95 and F2003 [5.1 Type declaration statements] contains:

R504 entity-decl is object-name [( array-spec )] [ * char-length ]
[ initialization ]
or function-name [ * char-length ]

Are we reading the standard correctly? Or is there a clause we have
missed?

Section 12.3.1 of N1601.pdf zaps these examples. You can get an
explicit interface if the procedure is an internal procedure, module
procedure, or intrinsic procedure. Procedures which may call
themselves have an explicit interface to themselves. Otherwise you
need an interface body to get an explicit interface. Then section
12.3.1.1 (3)(a) tells us that you need an explicit interface for an
array-valued function.

--
write(*,*) transfer((/17.392111325966148d0,6.5794487871554595D-85, &
6.0134700243160014d-154/),(/'x'/)); end


.



Relevant Pages

  • Re: subroutines as arguments
    ... easy as I thought even an external recursive procedure had an explicit ... interface within itself. ... I'm pretty darned sure that external recursive procedures have ...
    (comp.lang.fortran)
  • Re: explicit interface of a module function
    ... interface can only contain the declaration part. ... Since the function is in the module (and s not an external procedure, ... its interface is explicit within the module and in any procedure ... implicit none ...
    (comp.lang.fortran)
  • Re: Explicit and implicit interfaces
    ... subprograms in question follow CONTAINS. ... An explicit interface is an explicit ... interface, regardless of how it got that way. ... muddy the water by talking about externals. ...
    (comp.lang.fortran)
  • Re: subroutine argument question
    ... | John wrote: ... | explicit interface is the dummy argument an assumed-shape array? ...
    (comp.lang.fortran)
  • Re: indirect recursion in f90/95
    ... different code to make recursion work and thus a procedure without it ... Recursion is one of the longish list of things that require an explicit ... interface. ... If you use interface bodies, you need to specify recursive both ...
    (comp.lang.fortran)