"Paddy O'Brien" <[log in to unmask]> wrote:
> I'm replying to Van Snyder because one of his paragraphs makes me unsure
> of what should happen in F95.
>
> As in much of the previous discussion, I programmed on IBM machines back
> in the 1960's where we overlayed COMMON and routines.
>
> > This may be confusing because, although true, the passage you quote from
> > the LF95 manual, is only half of the story. The important distinction is
> > "can" instead of "does".
> >
> > Common variables are allowed to become undefined if no scoping unit that
> > accesses the common block is in execution. So if the main program calls
> > A and A calls B, and A and B declare the same common block, but don't give
> > it the SAVE attribute, and it's not declared in the main program, the values
> > defined in it by A and B remain defined until A returns to the main program.
> > At that instant the processor is permitted to undefine the varables in the
> > common block. It IS NOT allowed to undefine the common variables when B
> > returns because A is still "in execution."
> >
> > If a variable becomes storage associated with another variable that has
> > different type -- either by equivalence or common, assigning to one causes
> > the other to become undefined, atleast in the sense that the value has a
> > meaning defined by the standard.
> >
> > The same story holds for module variables.
>
> 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?
Declaring common in block data appears not to have an effect on when or if
it's elements are allowed to become undefined. If the SAVE attribute is
specified, the common block hangs around forever. However, if it's
specified in any program unit, it has to be specified in every program
unit in which the common block appears -- except for the main program.
--
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.
|