AHA! The culprit!! or one of them at least... :)
So why didn't you choose to allow
INTEGER, SAVE :: X=0
to be the obvious once-only initialization, and to be clearly different from
INTEGER :: X=0
???
(just a mild leg-pull, hindsight is 20-20 after all, its clear you and loads
of others spent many man-years getting the standard out for very little
reward apart from kudos. But while we're at it ... )
Qolin
Email: my qname at domain
Domain: qomputing dot demon dot co dot uk
----- Original Message -----
From: "J.L.Schonfelder" <[log in to unmask]>
To: <[log in to unmask]>
Sent: Saturday, January 14, 2006 7:34 PM
Subject: Re: initialized derived types
> Since one can write
> INTEGER::X
> X=0
> and mean set the "initial" value on entry to 0 which is different from
> INTEGER::X=0
> set the value at the start of the program rather than the entry gave
simple
> way to express two different and useful functionalities we oldies chose to
> make declared initialisation mean saved.
> What we lack is a way of stating that a local value is to be constant for
> an invocation but possibly different for different invocations, but this
is
> a minority interest!
>
> --On 14 January 2006 09:24 -0500 Aleksandar Donev
> <[log in to unmask]> wrote:
>
> > David,
> >
> > I believe that module variables that are initialized, as in
> > integer :: x=0
> > will automatically get SAVEd, though I don't have the standard right
here
> > at the moment. Certainly local variables in procedures do. This I
suspect
> > is a historical legacy that must be kept due to backward compatibility.
I
> > consider it a very bad "feature". Namely, there is a perfectly
reasonable
> > semantics to a local procedure variable not being saved---the variable
> > gets (re)initialized every time the procedure is executed. In fact, this
> > is what the standard does for local variables of derived type that has
> > default initialized components (which btw is a Fortran 95 feature,
> > probably the only important one :-). So I suspect that module variables
> > were done so that they behave similarly to procedure local variables,
but
> > I was too young back then to remember :-)
> >
> > I often miss the ability to have local procedure variables that get
> > reinitialized every time the procedure executes. One can of course do it
> > by putting the initialization as the first executable statement in the
> > procedure body, but why? Again, I suspect in the good old days when all
> > local vars were static and not on the stack it made sense to implicitly
> > give them the SAVE attribute. It certainly makes no sense to me today...
> >
> > Best,
> > Aleks
> >
> > --
>
>
>
> --
> Lawrie Schonfelder
> Home: 1 Marine Park, West Kirby, Wirral, UK, CH48 5HN
> Phone: +44 (151) 625 6986
> Mobile: +44 (0) 7885657457
|