Sorry for such a basic question. I use the following code all the time:
ie. The var x is initialised in the loop starter. A search on this board and comp.lang.c also shows thousands of instances of code like this.Code:for (int x=0;cond;expr) { .... }
However, when I do a lint check with this online lint checker:
http://www.cleanscape.net/products/l...ine/login.html
It gives me errors such as:
Is initialising a var like this not ansi or is this lint checker got problems. If it is not ansi, is there any compilers that do not support it?Code:for (int sectionIndex = 0;sectionIndex < 3;sectionIndex++) { ^ mx.c: line 153: Error # 33: Expression expected. --------------------------------------------------------------------- for (int sectionIndex = 0;sectionIndex < 3;sectionIndex++) { ^ mx.c: line 153: Warning # 102: Strange use of "for" statement. > The statement in question is of a form which may reflect some > sort of typing error; for example, the statement: > for (i = 0; i < 10; j++) { ... } > should be incrementing "i", not "j". --------------------------------------------------------------------- for (int sectionIndex = 0;sectionIndex < 3;sectionIndex++) { ^ mx.c: line 153: Error # 26: ';' expected. --------------------------------------------------------------------- for (int sectionIndex = 0;sectionIndex < 3;sectionIndex++) { ^ mx.c: line 153: Error # 21: Undefined symbol: sectionIndex



LinkBack URL
About LinkBacks


