On Thu, 19 Mar 1998, Lawrie Schonfelder wrote:
> I agree it can be a bit of a surprise but if what you want is the initial
> value at every invocation why not write
>
> INTEGER :: I
> I=0
But why not ... (see below)
>
> INTEGER :: I=0
>
> means something different which would be difficult to express under the
> proposed change.
Not at all, declare is SAVEd.
What I had in mind was the following:
Instead of writing, as required now,
Integer :: K=1 ! CAUTION: implicit SAVE
Integer :: I
I = 0
why couldn't F90 set the rules such that
Integer, SAVE :: K=0
Integer :: I=0 ! a real initial value
! used each time subroutine,etc
! is entered
would have the same effect, i.e. an explicit SAVE is required and hence
everything is easier to understand.
I just cannot understand what fundamental reason prevented F90 from
using this more intuitive rule. The current rule is an easy trap as
all responses show.
Cheers,
WWS
-----------------------------------------------------------------------
| Werner W Schulz |
| Dept of Chemistry email: [log in to unmask] |
| University of Cambridge Phone: (+44) (0)1223 336 502 |
| Lensfield Road Secretary: 1223 336 338 |
| Cambridge CB2 1EW Fax: 1223 336 536 |
| United Kingdom WWW: |
-----------------------------------------------------------------------
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|