[Info-vax] decrementing & for loops in C
JF Mezei
jfmezei.spamnot at vaxination.ca
Fri Jan 9 15:48:38 EST 2009
Bill Gunshannon wrote:
> What possible difference could it make wether you had the x++ in the
> parentheses part of the for loop or just on a line all by itself? It
> is still just x++ and should generate exactly the same code.
>
> for (x = 0; i; x++) something;
>
> x = 0; while ( i ){ x++; something; }
The alignment of the stars relative to the loudness of the neighbour's
dog ark may be more conducive to my using "for" loops instead of "while"
loops on that day ?
Ane exentric customer demanding that I never use "while" loops in the
programs I write for them ?
Or, the program origially uses the for loop in a conventional way. But
over time, the condition is changed and becomes too complex to fit
between the semi-colons in the "for" statement, so you just put a
variable there and put the complex condition in the code and leave that
block as a "for" loop.
So okay, there aren't compelling reasons to do that instead of "while".
More information about the Info-vax
mailing list