I had a nasty typo that wasted my time and my colleague\'s time, it was something like this:
for (i = 0; i < blah; i++); // <- I had a semi-colon here, tha
In addition to Lykathea's PC-Lint suggestion, you can also get better (or at least more) diagnostics if you bump up the warning level of the compiler. Something like /W4
or -Wall
Though I'm not sure if your particular problem would have been caught with this (MS VC doesn't seem to flag it even with all warnings enabled). I think that's because it's not an uncommon idiom for for
loops to be empty when the work is done as side effects of the loop control expressions.