For everyone else that doesn't know the basic styles off the top of their head:
Code:

Allman/BSD Horstmann GNU Whitesmiths K&R

if (b) if (b) if (b) if (b) if (b) {
{ { x = 1; { { x = 1;
x = 1; y = 2; x = 1; x = 1; y = 2;
y = 2; } y = 2; y = 2; }
} } }



Personally, I use K&R, though I disagree with Jeff's theory about how/why it evolved. I tend to think it's just so that you can fit one more lines of real code on the screen, instead of taking a line for an opening brace on its own. The if() line is sufficient to signal the opening of a block.

I disagree with the "braces should line up" theology -- I can always tell where a compound statement block starts, based on the indent level. Of course, if there's no indenting, you're hosed, but in that case, having all the braces line up doesn't help any, either. If I need to find the corresponding opening brace for some reason, I can just use the % key*.

IMHO, Horstmann is awful -- in the example given, how easy would it be to swap those two variable initialization lines, if you wanted to (compared to doing the same in any of the other styles)?

The problem with GNU is that you end up with a non-standard indent level that's special just for braces, so you have to tab/indent twice (as opposed to once) for the code within the block. Laziness rules.


* -- yes, this is an implicit admission that I use VIM.