News for hackers. Stuff that matters.

Poll

K&R 31 votes
Allman 16 votes
Other 6 votes
1TBS 14 votes
Re:Poll: Allman or K&R Indentation? by rednum on Wednesday July 27, 2011 @10:13AM (#2812216)
Something like 1TBS style. I it is quite popular among my friends and different to both K&R and Allman. You could add it to the poll, since there are few votes at the moment and bias won't be too big.
Re:Poll: Allman or K&R Indentation? by ChuckMcM on Wednesday July 27, 2011 @08:14PM (#2814838)
I find the 1TBS style maximizes the number of lines I can get on the screen which helps in understanding what the code is doing.

I don't miss the opening brace because when I see the closing brace I can go straight up to the controlling statement.

A variant that Sun used to use was that for functions you defined them thusly:

int function_name(args) { ... }

The benefit was that grep '^function_name' *.c would turn up the file with the definition (vs the prototypes which were of the form int function_name(...))

Re:Poll: Allman or K&R Indentation? by jam on Wednesday July 27, 2011 @10:00AM (#2812168)
K&R, but technically more like 1TBS (as described on Wikipedia).
Re:Poll: Allman or K&R Indentation? by Peteris on Wednesday July 27, 2011 @01:04PM (#2813030)
There are some languages, e.g., javascript, which practically force you to use K&R. In C++ and Java, I always prefer Allman though. Of course it is more readable than K&R, but, I think the choice is driven by the editor. I use Vim, which makes it dead easy to manipulate lines as a whole. I also like to have single statements without braces, so it is much easier for me to to quickly remove stray '{'s or add them as needed when the number of statements changes within a block.
Re:Poll: Allman or K&R Indentation? by lurch_mojoff on Wednesday July 27, 2011 @10:39AM (#2812311)
I'm definitely in the K&R camp. I keep alternating between 1TBS and Compact Control Readability, depending on the preferences of the other members of the team working on that particular project. I personally prefer Compact Control Readability.
Re:Poll: Allman or K&R Indentation? by dfreidin on Wednesday July 27, 2011 @06:10PM (#2814444)
I personally prefer Allman, but if I'm working with existing code, I'll use whatever style the code already uses.
Re:Poll: Allman or K&R Indentation? by kieni on Wednesday July 27, 2011 @09:55AM (#2812151)
Depends on the language. For me, Allman is easier (==cleaner) to read.
Re:Poll: Allman or K&R Indentation? by TNO on Wednesday July 27, 2011 @09:52AM (#2812131)
A language that avoids the question