I believe the advantage of

> if (...) {
>   ...
> } else {
>   ...
> }

is to write very dense code, especially when the block itself is single
line.
This style may not be readable to some people.

This style is not very consistent,
> if (...) {
>   ...
> }
> else
> {
>   ...
> }

I believe it would better be

/* comment */
if (...) {
  ...
}
/* comment */
else {
  ...
}

The advantage of this style is not as dense as previous one, and 
good for comment.

if (...)
{
  ...
}
else
{
  ...
}

The last style is very sparse, and very readable. It just wastes
too much screen and paper (if you wanna print).

BTW, I am not sure it has been mentioned already. We should enfore
{} even for single line block. Since we use plenty of macros that
may be expanded to multi lines, it is much safer and consistent
to always use {}.

Hong

Reply via email to