c++.beta - for loop increment expression and if statement
- Richard Grant (9/9) Feb 13 2003 Not sure if this should be legal or not.. standard says "most" statement...
- Walter (4/10) Feb 13 2003 are
Not sure if this should be legal or not.. standard says "most" statements are expressions. int main() { for (int i=0; i < 10; i++, if (i == 5) break); // Error: expression expected } A work around: for (int i=0; i < 10; i++, (i == 5) ? i = 10 : 0); Richard
Feb 13 2003
"Richard Grant" <fractal clark.net> wrote in message news:b2h7fk$2rj8$1 digitaldaemon.com...Not sure if this should be legal or not.. standard says "most" statementsareexpressions. int main() { for (int i=0; i < 10; i++, if (i == 5) break); // Error: expression expected }I don't think it's legal.
Feb 13 2003