Re: Statement function host association



James Giles wrote:
>
> Michael Metcalf wrote:
> > "James Giles" <jamesgiles@xxxxxxxxxxxxxxxx> wrote in message
> > news:bpuie.780623$w62.472457@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> ...
> >> Now, according to Fortran's rules, J behaves as-if it were declared
> >> in the widest possible scope, MySub in this case. Which means that
> >> the two internal procedures are actually sharing J!
> >>
> > James, could you please construct a compilable example of this? As I
> > understand it, the 2 instances of J are separate local variables.
>
> Well, now I find I need an interp. The statement is (quoted from page 93
> of the f2003 standard, since that's most easily available at the moment,
> about line 13):
>
> The data entity is treated as if it were declared in an explicit type
> declaration in the outermost scoping unit in which it appears.
>
> Now to me that means that the two J's ought to be shared, but the
> standard then gives a (non-normative) example showing a similar
> case in which the variables (Z in that case) are not shared.
>
> --
> J. Giles


But in this case aren't the two relevant scoping units the subroutines
in which the two instances of the (local to each) instances of J are
defined? That's certainly my interpretation.
.