I've got exactly the opposite philosophy. A loop counter is
i, ii, iii, iv, v to represent levels of nesting. j is a secondary
loop counter (e.g. if you're removing spaces from a string, j
would represent the write position and i the read position).
N counts things, a string is str, a real is x (x is also obviously
an integer co-ordinate), an angle is theta.
Obviously sometimes you need more specific names. But usually I
find that conventions will cover most cases.
I've found that meaningful names are far more useful than arbitrary
names for checking the validity of code. Here's a slightly simplified
example from the main program I'm responsible for: "orb" refers to the
ORBital reference frame, "ecr" refers to the Earth Centered Rotating
reference frame, and "sc" refers to the SpaceCraft reference frame. We
use the naming convention T_x2y for orthonormal rotation matrixes for
transforming vectors from reference frame x to reference frame y.
for (ecr=0; ecr<3; ecr++)
for (sc=0; sc<3; sc++)
{
T_sc2ecr[ecr][sc] = 0.0;
for(orb=0; orb<3; orb++)
T_sc2ecr[ecr][sc] +=
T_orb2ecr[ecr][orb] * T_sc2orb[orb][sc];
}
for(sc=0; sc<3; sc++)
{
sol_sc[sc] = 0.0;
for(ecr=0; ecr<3; ecr++)
sol_sc[sc] += T_sc2ecr[ecr][sc]*sol_ecr[ecr];
}
I can easily determine that each and every index used in those code
fragments is used correctly - with this naming convention, every T_x2y
matrix must be subscripted [y][x]; anything else is manifestly wrong.
Code like this occurs in many locations in my programs (we use about 6
different coordinate systems). Before I introduced those index naming
conventions, one of the most common mistakes in our code was indexing
rotation matrices with the wrong variables.
Such mistakes were often introduced indirectly by calling a matrix
multiplication function that calculated C=A*B, when what was actually
needed was C=A*transpose(B). The approach shown above can handle
A*transpose(B) as easily as A*B.