Ever since I spent a week wondering why my main loop only ran 3 times, I always turn syntax highlighting on.
This is what my code looked like:
// Initialise
for (i=0;i<3;++i) {
/* Do initialisation here!
niftyConfig = 1;
funkyValue = 2;
}
// Run forever
for (;;) {
/* So, this is where we do stuff! */
...
}
Syntax highlighting would have shown the problem instantly. In fact, the bug would never have happened.Anything that can increase the chance to catch an error is a good thing.
[EDITED for code formatting.]