Re: MR&C 7.9
- From: "Lane Straatman" <invalid@xxxxxxxxxxx>
- Date: Thu, 15 Mar 2007 17:20:48 -0400
"Richard Maine" <nospam@xxxxxxxxxxxxx> wrote in message
news:1hv0q9i.1bc34nmfmigxdN%nospam@xxxxxxxxxxxxxxxx
Lane Straatman <invalid@xxxxxxxxxxx> wrote:I didn't say this was a good idea. The sentence is quite true though, that
Right
at the beginning of execution, a has been set to 0.0 . You can actually
comment out:
a=0.0
and get the same output .
No! No! No!
using illegal code, I got the same output. That this is illegal makes me
wonder about that run-time I had up-thread. When I toggled between
real, save :: a
!real :: a
I would get a run-time error when I hit
a = a + x
if a had not been saved, and ,consequently, on my machine, initialized to
zero. If this initilization is not something you can count on, then isn't
real, save :: a
a = a + 1.0
also illegal?
That is *NOT* guaranteed. If you comment out the a=0.0, then what youI tried to find relevant material in the standard (04-007 pg 87, 91), but
have is illegal code. It will do different things on different
compilers, or perhaps even on the same compiler with different options.
In some cases it will be set to zero as you observed. In other cases, it
will be set to random garbage. In yet other cases, the compiler will
catch the error and abort the program.
The standard says that the initial value of "a" is undefined. That is
standard-speak for "anything can happen; don't count on it; adn just
because you observe some behavior in one case, still don't count on it".
This newsgroup quite regularly ends up helping people whose programs no
longer work because they depended on that behavior. I recommend against
joining the ranks of people who will need such help in the future.
found nothing.
--
LS
.
- Follow-Ups:
- Re: MR&C 7.9
- From: Michael Metcalf
- Re: MR&C 7.9
- From: Richard Maine
- Re: MR&C 7.9
- From: glen herrmannsfeldt
- Re: MR&C 7.9
- References:
- MR&C 7.9
- From: Lane Straatman
- Re: MR&C 7.9
- From: Michael Metcalf
- Re: MR&C 7.9
- From: Lane Straatman
- Re: MR&C 7.9
- From: Rich Townsend
- Re: MR&C 7.9
- From: Lane Straatman
- Re: MR&C 7.9
- From: Rich Townsend
- Re: MR&C 7.9
- From: Lane Straatman
- Re: MR&C 7.9
- From: glen herrmannsfeldt
- Re: MR&C 7.9
- From: Lane Straatman
- Re: MR&C 7.9
- From: Dick Hendrickson
- Re: MR&C 7.9
- From: Lane Straatman
- Re: MR&C 7.9
- From: Richard Maine
- MR&C 7.9
- Prev by Date: Re: Gfortran 2 years behind G95 and still not ready for prime time
- Next by Date: Re: Windows gfortran binaries
- Previous by thread: Re: MR&C 7.9
- Next by thread: Re: MR&C 7.9
- Index(es):
Relevant Pages
|