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.
.



Relevant Pages

  • Re: Statement function host association
    ... > James Giles wrote: ... now I find I need an interp. ... >> page 93 of the f2003 standard, ... the implicit declaration is to correspond to a virtual explicit ...
    (comp.lang.fortran)
  • Re: Statement function host association
    ... > declaration in the outermost scoping unit in which it appears. ... > standard then gives a example showing a similar ... The data entity in question doesn't appear in the host scoping unit. ...
    (comp.lang.fortran)
  • Re: Function PRESENT and logical combinations
    ... James Giles wrote: ... > Richard Maine wrote: ... >>about the standard or the poster. ... >>represent omission of the implied qualification. ...
    (comp.lang.fortran)
  • Re: Bounds of Arrays
    ... James Van Buskirk wrote: ... > "James Giles" wrote in message ... >> I'm pretty sure the standard doesn't permit X and Y to ... no deficiencies and the other way is to make it so complicated ...
    (comp.lang.fortran)
  • Re: Kind of NOT integer constant
    ... > James Giles wrote: ... > if the argument is a default integer, because the standard ... >> not permitted to carry extra precision in an INTEGER ... no deficiencies and the other way is to make it so complicated ...
    (comp.lang.fortran)