inicio mail me! sindicaci;ón

Braces - which style?

if (true)
{
    doSomething();
}
else
{
    doSomethingElse();
}

One last thing. On the C/C++ braces style. It has gotta be ‘Allman’ for me. It just looks so much more readable when there is symetry.

Steve Dekorte said,

October 21, 2004 @ 5:58 pm

I like that style to, although I prefer it without the empty lines.

Dru said,

October 21, 2004 @ 6:15 pm

The empty lines really aren’t there. For some reason the PRE tags are doing that.

Jim said,

October 21, 2004 @ 8:23 pm

IMHO, for big chunks of code:

if ( x == y ) { DoSomething(); } else if ( x == y ) { DoSomethingElse(); } else { }

( 2 spaces per indent, 1 space padding )

if ( x == y ) DoSomething(); else DoSomethingElse();

or

if ( x == y ) DoSomething(); else if ( x == y ) DoSomethingElse(); else if ( x == y ) DoSomethingElse(); else if ( x == y ) DoSomethingElse(); else if ( x == y ) DoSomethingElse(); else DoSomethingElse();

Is OK, as long as there is at least one empty line above and below.

RSS feed for comments on this post · TrackBack URI