Community
Participate
Working Groups
Some developers consider the following as bad practice: while (goAhead) doSomething(); Rationale: it is much easier then to mistakenly add further statements out of the loop, like into: while (goAhead) doSomething(); doMore(); // indented, but NOT into the loop than if braces are systematically added, like into: while (goAhead) { doSomething(); } doMore(); // clearly out of the loop A warning could be issued to help enforce coding policies that demand the use of explicit braces for all applicable control structures. This would at least include if (and else), while, do and for. The cases of a switch should probably be left out of this, given the typical fall through pattern.