Is else while without intervening braces considered "safe" maintenance wise?
Writing if-else code without braces like below...
if (blah)
foo();
else
bar();
...carries a risk because the lack of braces make it very easy to change the meaning of the code inadvertently.
However, is below also risky?
if (blah)
{
...
}
else while (!bloop())
{
bar();
}
Or is else while without intervening braces considered "safe"?


else whilelooks icky. I'd useelse { while (condition) { ... } }. – Joachim Sauer Dec 20 '12 at 9:53ifis only evaluated once, butwhiledenotes a loop, so connecting both gives me a unsubstantiated feeling that theifis part of the loop... somehow... – user281377 Dec 20 '12 at 11:20elseclause you want to do thewhileand do something more? Just use braces, please. – Carlos Campderrós Dec 20 '12 at 14:29