On Thu, 19 Mar 1998, Alberto Fasso' wrote:
> SAVE did not exist in Fortran 66 (or Fortran IV, call it as you like).
> Maybe you are all too young to remember that, but in those times ALL
> variables were saved by all compilers (whether required by the standard
> or not I don't know). I remember well my disappointment when I learned
> about the new rule, which would have forced me and my colleagues to
> check thousands of lines of code.
I'm old enough to remember Fortran66 - but also remember that the Standard
really didn't specify whether or not local variables in subprograms were
preserved or not. Prudent programmers assumed that only things in COMMON
blocks would retain their value - so it was a great improvement when
Fortran77 came along and SAVE was introduced to allow one to specify this
for local variables as well. And, as has already been pointed out, quite a
few Fortran77 compilers did not save everything by default. Among the
exceptions are/were compilers by SGI and Cray. Come to think of it,
aren't they now the same company. Did the executives know how compatible
they were :-)
But all you had to do to convert unsafe F66 code to safe F77/F90/F95 code
is to insert simple line:
SAVE
in the start of each subprogram. Even if you have millions of lines of
code, this is easy to automate.
But to return to the main point: despite what Walt Brainerd and others
have said in defending the current syntax, I know that it is easy enough
to tell students that
INTEGER :: counter = 0
and
INTEGER :: counter
counter = 0
have quite different effectsin a procedure, but it's still not all that
obvious and therefore easy to forget. We have to remember that quite a
few people learning Fortran have previously learned C (or something even
nastier) and then the Fortran behaviour seems even more counter-intuitive.
So I still support efforts to have an "UNSAVE" attribute, whatever it is
called.
--
Clive Page, Internet: [log in to unmask]
Dept of Physics & Astronomy,
University of Leicester, Phone +44 116 252 3551
Leicester, LE1 7RH, U.K. Fax +44 116 252 3311
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|