Paddy O'Brien writes:
> I'm replying to Van Snyder because one of his paragraphs makes me unsure
> of what should happen in F95.
There is NO change in any of this stuff (SAVE and COMMON) in f95. Or
in f90 or f2003. It is all the same as in f77.
> I've left all of the above in, but know wonder if my understanding is
> correct. I believe that in F95, any local variable declared with data,
> either on the type declaration or in a DATA statement is "saved". What
> happens with COMMON declared in BLOCK DATA routines? Are they assumed
> declared at the highest level, or at teh level in which they first appear?
Variables in common can never have the save attribute...which is no
doubt why the bit in th estanhdard saying that data implies save
starts out with
"Except for variables in named common blocks,..."
so the question is moot. The secret here is that the whole common
block gets saved, not the individual variables in it.
Common is quite a complicated thing. My observation is that most of
the people who explain how simple and intuitive common is (and there
are lots of people who say that) don't actually understand common;
what is simple and intuitive is the restricted way that they happen
to use it - not the way that it is actually defined.
Part of the reason I bring that up is that, in some complicated way,
common blocks aren't composed of variables. Common blocks are
really composed of sequences of storage units (and then the variables
are mapped onto those storage units). Wouldn't surprise me at all to
find that the standard is internally inconsistent about its
description of common.
Anyway, that part is just a sideline as part of the explanation
of why variables in common aren't saved. It is more like that
the storage sequences are saved and the variables get the effect.
--
Richard Maine | Good judgment comes from experience;
[log in to unmask] | experience comes from bad judgment.
| -- Mark Twain
|