Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Comments
-
prvInSpace24015dWell thats not entirely correct. K&R look like that for if, while, and for statements. For functions it look like Allman. Like this:
int main()
{
if(something){
statement;
}
return 0;
}
What you probably are referring to is the True Bracket Style. (1TBS) -
argorain101315d@prvInSpace Good point and perfectly true. And although I am preferring 1TBS, original K&R is still makes more sense to me than Allman...
-
NaCl115dI think it has to do with the first code language that you are introduced to. I started with Delphi 7 and we were forced to follow Allman for those four years. So now anything else just feels wrong.
-
prvInSpace24015dI use both K&R and 1TBS. It depends on which programming language I am using. For C I always use K&R and for Java I only use 1TBS.
The one I can't stand is the GNU one. It's so horrible. -
i see 2 them as kinds of developers styles: c/c++ and java.
God bless you if you ever tell the formers that java or ita indentation styles are better. -
snaz123815dThe correct way to format code is the way your IDE automatically formats it and is consistent with your team.
-
monkeyboy56515dI'm in the "it's what you learned initially" boat. For me, it's TBS all the way (from early c, c++ days). IMO, it's so much easier to visually identify matching brackets.
-
iamavalos115415dwhat
about (gnu coding,
standards which)
{
are sometimes;
very confusing;
sometimes = "hard to read";
very = "painful to use";
but_i_love_it (VERY (confusing),
ARE (sometimes));
return confusing; /* software */
}
God, Allman indentation style is such pain... God bless K&R...
For those who don't know, Allman is this:
void foo(void)
{
statement;
statement;
}
and K&R is this:
void bar(void) {
statement;
statement;
}
rant
k&r
indentation
c
allman