Well, I really like the solution, provided here (I'm sorry, it's not translated in English):
#define FOR(I,UPPERBND) for(int I = 0; I<int(UPPERBND); ++I)
The main idea is described in this way: when we talk about simple iteration-indexed-cycles, we do not need to think about it. However, when we use for(;;) construction- there are always three steps: initialization, end condition check, iteration. And this is an overkill for such a simple loop, as just i:[0,n).
I liked the idea, that we want to write simple things in a simple way. When you see that FOR(i,N) - you just know, that there are nothing special. When you see the for(;;) construction - you have to be more careful and see all three parts of it.
Just an example from that article:
for (int iter=0; iter<nb_iter; iter++) { // some iterative computation
for (int c=0; c<mesh.cells.nb(); c++) // loop through all tetrahedra
for (int lv0=0; lv0<4; lv0++) // for every pair of
for (int lv1 = lv0+1; lv1<4; lv1++) // vertices in the tet
for (int d=0; d<3; d++) { // do stuff for each of 3 dimensions
nlRowScaling(weight);
nlBegin(NL_ROW);
nlCoefficient(mesh.cells.vertex(c, lv0)*3 + d, 1);
nlCoefficient(mesh.cells.vertex(c, lv1)*3 + d, -1);
nlEnd(NL_ROW);
}
[...]
}
become a:
FOR(iter, nb_iter) {
FOR(c, mesh.cells.nb())
FOR(lv0, 4)
for (int lv1 = lv0+1; lv1<4; lv1++)
FOR(d, 3) {
nlRowScaling(weight);
nlBegin(NL_ROW);
nlCoefficient(mesh.cells.vertex(c, lv0)*3 + d, 1);
nlCoefficient(mesh.cells.vertex(c, lv1)*3 + d, -1);
nlEnd(NL_ROW);
}
[...]
}
And you see, where you should concentrate your attention.