Ian Romanick wrote:
Over the years, I have encountered *may* bugs like this. One way to help combat them is to have a policy that empty loop parts are documented with a comment of /* empty */. It makes it explicit to people reading the code that the missing parts are intentionally missing. It also helps prevent deletion of the "stray" semicolon of an empty loop body.
Some compilers have an option to warn on empty loop and "if" bodies. To shut it up, you can replace the ";" with an empty block instead: "{ }", which also shows the intention more clearly to humans. Surprisingly, gcc does not seem to support this warning as of 4.1. -- // Bernardo Innocenti \X/ http://www.codewiz.org/