Re: save statement in a module
- From: glen herrmannsfeldt <gah@xxxxxxxxxxxxxxxx>
- Date: Tue, 10 Jun 2008 10:55:08 -0800
jel wrote:
(snip)
I'm not sure this applies to the code I posted. Note that I have
IMPLICIT NONE both at the module level and for the ACCUM procedure.
The variable X is not declared within ACCUM, so the variable X always
refers to the module level variable X (otherwise I would have gotten a
compile time error). So, adding the SAVE to the ACCUM procedure
doesn't magically declare a local variable X (or does it? I hope
not.).
It does with X on the SAVE statement, otherwise
it doesn't. I assumed that it wasn't, Richard assumed that
it was.
As mentioned here recently, C does not have implicit declaration
in the Fortran sense. C89, though, does have something similar.
If you declare a variable with some other attribute it will
be implicitly declared as int. (But all the other keywords
are longer than int so it doesn't save typing.)
The statement SAVE X in a module subroutine would declare
a new real variable X separate from the module variable.
On a happy note, I did find an error that was causing the "real"
problem but it is far too embarrassing to confess.
Most likely not worse than any of us have done, and
it would help others not to do the same if you explained it.
-- glen
.
- References:
- save statement in a module
- From: jel
- Re: save statement in a module
- From: Craig Powers
- Re: save statement in a module
- From: Richard Maine
- Re: save statement in a module
- From: jel
- save statement in a module
- Prev by Date: Re: save statement in a module
- Next by Date: Re: The linf project
- Previous by thread: Re: save statement in a module
- Next by thread: .mbx and fortran
- Index(es):
Relevant Pages
|