Hacker News new | ask | show | jobs
by desdiv 1635 days ago
I foresee two problems with that:

Problem 1:

If i is used multiple times inside the loop, then you might need to make a temporary variable for it, making it confusing:

for (size_t i_plus_one = size; i_plus_one > 0; i_plus_one--) {

size_t i = i_plus_one - 1;

f(i);

g(i);

h(i);

...

(The alternative is a bunch of i-1 all over the place, which is also confusing.)

Problem 2:

If operations inside the loop is short, then the extra "i-1" arithmetic could result in unacceptable performance penalties.