Toby White <[log in to unmask]> wrote:
> (Hello, Anthony)
>
> On Fri, Feb 21, 2003 at 11:51:09AM +0000, Anthony Stone wrote:
> > I have a module in which the following kind of thing appears:
>
> [snip code]
>
> > Is there a bug in my code (and perhaps in the second compiler) or a bug
> > in the first compiler? If it's my code that's wrong, how do I fix it?
>
> According to the F95 standard: section 12.3.2.2
> "If an external procedure name or a dummy procedure name is used as an actual
> argument, its interface shall be explicit or it shall be explicitly declared
> to have the EXTERNAL attribute."
>
> Which implies that the first compiler is wrong, and your code correct.
>
> Does the first compiler work if you declare func external within subroutine c?
Declaring FUNC to be external within subroutine C in Anthony Stone's
example would have no effect, since FUNC isn't otherwise referenced within
subroutine C. But Toby's analysis would be correct if applied to the
dummy argument F of subroutine C. The compiler is correct in complaining,
but it's giving a pretty goofy diagnostic. Subroutine C has explicit
interface at the point of its call from within subroutine B. The compiler
ought to complain that the dummy argument F of subroutine C is not declared
to be a procedure, but the actual argument FUNC in the call to C from
within B is a procedure. It ought also to complain that the CALL F within
subroutine C is improper because F is not declared to have the EXTERNAL
attribute. Many compilers don't do this, because so many "legacy" codes
don't conform. Anthony: If your compiler has a "strict conformance" option,
and you've not been using it, try it and see if the compiler complains.
In any case, declare F to be external. The way I prefer to do this is
with an interface block and interface body, but an EXTERNAL statement is
good enough.
--
Van Snyder | What fraction of Americans believe
[log in to unmask] | Wrestling is real and NASA is fake?
Any alleged opinions are my own and have not been approved or disapproved
by JPL, CalTech, NASA, Sean O'Keefe, George Bush, the Pope, or anybody else.
|