Arnd Beißner wrote:
Jeremias Maerki wrote:

The following should (sorry, could) be ok:

  for (int i = 0; i < 5; i++) {
      doSomething();
      if (amIRight()) cool();
      doSomethingElse();
  }

One point here:
If it's not amIRight() but

if (amIRight() || ( more stuff follows .............) cool();
doSomethingElse();

you tend to ignore the cool() stuff in favor of doSomethingElse.
Yep.  It takes an eye for layout, which seems appropriate.

I can't count the times I've seen people hunt for this kind of
bug (most when changing someone else's code, of course).

Which is why I always use:

if (foo)
doFoo();

On the whole I think you would be served best by forbidding

if (foo) doFoo();

and allowing

if (foo)
doFoo();
else
doBar();

as well as

if (foo) {
doFoo();
} else {
doBar();
}

leaving this issue to personal taste.
This man must be one of them there anarchists.

Just my 2 cents.
Peter
--
Peter B. West  [EMAIL PROTECTED]  http://www.powerup.com.au/~pbwest/
"Lord, to whom shall we go?"


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to