note
MADuran
<a href="http://webstore.ansi.org/ansidocstore/product.asp?sku=ISO%2FIEC+9899%3A1999">ANSI/ISO/IEC Standard 9899:1999 (C99 Standard)</a> (Link to ANSI's Store) allows allocation of the identifer in the for statement and scopes the identifer to the loop only <p/>
This code is now legal in C99 compilers (which to my knowledge there are not very many)<p/>
<code>
for(int i=0; i < 100; i++){
/*do some thing with i */
printf("this is i: %d", i);
}
</code><br/>
and it is lexically the same as: </p>
<code>
{
int i;
for(i=0; i < 100; i++){
/*do something here with i */
printf("this is i: %d", i);
}
}
</code>
**This code is Not Tested (even for correctness)**
<br/>Note that the second code sinpet is blocked, limiting the scope of i in the for statement.
References are the Swedish Instute of Computer Science (which posted the C99 Standard <a href="http://www.sics.se/~pd/ISO-C-FDIS.1999-04.pdf">here (a PDF)</a> if this is not a legal posting please remove link) <br/>6.8.5.3 is the paragraph dealing with the FOR statement <p/>
And this <a href="http://home.tiscalinet.ch/t_wolf/tw/c/c9x_changes.html"> overview of C99</a> <p/>
This does NOT invalidate your argument about pre c99 compilers or non-complying compilers. And if you declare your iterator loop varable before the for loop it will work the same as it did previouly. I point this out because I think that this is what these other fine Monks must be thinking of.<p/>
MADuran who must now find a spiffy sig.
317444
317541