12-01-2009, 10:21 AM
Quote:A for loop shall contain a single loop-counter which shall not have floating type.
Is following code compliant?
Code:
void foo() {
const char * x = "Foo";
for (const char * ptr = x; *ptr; ++ptr) { // Compliant?
// ...
}
}
In my opinion the loop-control-variable (ptr) is not "an operand to a relational operator in condition" (the variable pointed to by the ptr is the operand) so it does not meet conditions for a loop-counter.