Re: Array Constructors



cjk32@xxxxxxxxx wrote:
On 28 Feb, 12:50, "Michael Metcalf" <michaelmetc...@xxxxxxxxxxxxxx>
wrote:
<c...@xxxxxxxxx> wrote in message

news:1172660739.879054.15000@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Hello,
Can anyone confirm that when a variable is used in an implied do loop
in an array constructor, is its value always restored afterwards.
Please note that the do variable of an implied-do in a DATA statement or an
array constructor has a scope that is just the implied-do. It is different
from any other entity with the same name (i.e., you have two variables
called i in your snippet, so to think about 'restoring' is not correct).
(See also MR&C, Section 5.15.)


That was my initial thought, but IVF complaining if *a* variable, i,
wasn't declared somewhere in the same scope in unsettled me somewhat.
Arjen makes a good point, but if I try it with a non integer variable,
IVF complains again, saying that an integer is required. I guess this
is just a bug in the IVF compiler.

Are you using IMPLICIT NONE? If so, then all variables need to
be declared, even those with statement or construct level scope.


*** Hendrickson

I assume 'MR&C' refers to an official fortran spec. Is that available
online anywhere?

Regards,


Chris

.


Quantcast