[sv-bc] foreach iteration order

From: Bresticker, Shalom <shalom.bresticker_at_.....>
Date: Mon Dec 07 2009 - 23:01:29 PST
The order in which a foreach loop iterates over the elements does not seem to be specified clearly.
Is the order deterministic? The LRM does not say explicitly. 12.7.3 does not seem to say anything.

There are statements in the LRM that imply that there is a definite ordering.

11.4.14.1 says, "Other unpacked arrays are processed in the order in which they would be traversed by a foreach loop (see 12.7.3) having exactly one index variable;"

12.7.3 does have an example, "The first foreach-loop causes i to iterate from 0 to 1, j from 0 to 2, and k from 0 to 3. The second foreach loop causes q to iterate from 5 to 1, r from 0 to 3, and s from 2 to 1 (iteration over the third index is skipped)."

Shalom

Shalom Bresticker
Intel LAD DA, Jerusalem, Israel
+972  2 589 6582 (office)
+972 54 721 1033 (cell)
http://www.linkedin.com/in/shalombresticker


---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Mon Dec 7 23:11:29 2009

This archive was generated by hypermail 2.1.8 : Mon Dec 07 2009 - 23:14:15 PST