I just recently noticed that for [for] loop in every single code I wrote and from code snippet in VC#, both use the same following code pattern (notice the increment pattern):
for (int i = 0; i < length; i++) {}
AFAIK, the increment condition I should be the next
value which is [i = i + 1]. And I think [i = i + 1] is better translated as [++i] rather than [i++], though both of them behave indifferently in the looping process.
What do you think about this, guys

[var++] or [++var] for [for] loop
MaNicXs
I think the same.
But on the same topic, what's the difference from the efficiency point of view between
for (i=0; i<max; i++) makeSomething();
and
for (i=0; i++<max;) makeSomething();
or even (if correct)
for (i=0; i++<max; makeSomething());
Richard Pfeiffer
its the same thing really, no difference just user perference i believe:
i = i + 1
i++
++i
to me I believe is the same thing
jhudson
for (initstatement; testexpr; loopstatement) statementblock
is:
initstatement;
loop:
if (testexpr) {
statementblock;
loopstatement;
goto loop;
}
Of course, there's only one canonical form that is considered highly readable...