Proposal: text to resolve: Re: [sv-bc] Ambiguity in comma-separated for loop initializer list

From: Rishiyur S. Nikhil <nikhil@bluespec.com>
Date: Tue Mar 16 2004 - 10:16:53 PST

Attached is my proposal to resolve ambiguities in comma-separated
for-loop initializers, per our con-call discussion yesterday.

No change in BNF or in intent, just adding some clarifying text
at the end of 8.5.2

Nikhil

Proposal for clarifying multiple local var decls in for loops Add the following text to the end of Section 8.5.2:

In a for loop initialization, either all or none of the control
variables are locally declared.  In the second loop of the last
example, count, done and j are all locally declared.  The following
would be illegal, since it is attempting to locally declare y whereas
x was not locally declared:

    for (x = 0, int y = 0; ...)
        ...

In a for loop initialization that declares multiple local variables,
the intialization expression of a local variable can use earlier local
variables.

    for (int i = 0, j = i+offset; i < N; i++,j++)
        ...

Received on Tue Mar 16 10:16:56 2004

This archive was generated by hypermail 2.1.8 : Tue Mar 16 2004 - 10:17:00 PST