range-based loop: invalid example
General Information
Mantis ID/URL: 8223
Clauses: 19.4.2 -- The range based loop
Affiliation: Matthias Simon -- Nokia
Description
Example 3 is problematic and potentially invalid.
// Iterate over partially initialized ranges
//
var integer e, i := 0;
for (e in {1, -, -}) {
i++;
}
log("final value:", e);
// Output:
// 0
// 1
// 2
//final value: -
It should be replaced by something less controversial:
// Iterate over partially initialized ranges
//
var integer i := 0, e := 0;
for (e in {10, -, 30}) {
log(i, e)
i++;
}
log(i, e);
// Output:
// 0 10
// 1 UNINITIALIZED
// 2 30
// 3 30