Fortran do loop variables: restrictions on control variable memberships?
Is there a restriction that the control variable of a DO loop cannot be an element of an array? For example, the following code does not compile on both compilers I've checked:
Code:
program loop Code:
program loop |
Hi.
I think it is a grammatical restriction. If you take a look at the source code of `f2c' you will find that control variable should be a `name' (excerpt from src/gram.exec): Code:
exec: iffable Code:
name: SNAME In theory this restriction could be easily thrown, but for some reasons it is not. Semantically, using an array element as loop counter makes sense and in some languages (in C for example) is allowed. |
Hi.
In Modern Fortran Explained, Metcalf et al, page 60, 4.4 The do construct: Quote:
http://www.amazon.com/Explained-Nume...2019575&sr=8-1 |
All times are GMT -5. The time now is 02:53 AM. |