Print

Print


--On Friday, March 19, 2004 9:55 PM +0200 Jan van Oosterwijk
<[log in to unmask]> wrote:


>     forall(i = 1:n-1, j = i:m-1)

> I can't find a restriction in the standard that forbids this.

Well, I don't see it forbidden in so many words, but it doesn't
make sense and is thus indirectly forbidden by either of two
things.  First, you are referencing an undefined variable
(I isn't defined when you are needing it to be).  Second,
the standard doesn't give an interpretation of what this
would mean (and there's a very general statement that things
that have no interpretation givven by the standard are
illegal).

Where are you expecting the value of i to come from for the
j=i:m-1 part?  Presumably you expect it to be from the i index
variable, but that doesn't have a defined value yet when you
need it; it doesn't have a value until you are executing
the body of the forall.

See 7.5.4.2 of f95 (which is too long to quote in detail).
In particular note that the determination of the values
for the index name variables (all of them) is done *FIRST*.
Then, it is only the forall body that is executed for each
combination of the index values.  You don't do the determination
of some of the index values for each of some of the other index
values.

I think what you basically have is "j=something_undefined:m-1".

--
Richard Maine                |  Good judgment comes from experience;
[log in to unmask]       |  experience comes from bad judgment.
                             |        -- Mark Twain