[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

Why is Allman usually not the bracket/indent style of choice?

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 58
Thread images: 10

Why is Allman usually not the bracket/indent style of choice?

It makes more sense, helps visualize nested code and looks more symmetric.
>>
>>56866910
Fuck off pajeet
>>
>>56866910
because most people don't care to brag about loc.
>>
K&R is the one true brace style you blasphemer.
>>
Allman is better but javascript monkeys can't use it because

return
{
foo: bar,
}

does not work (I think the interpreter inserts a semicolon after the return statement)
>>
>>56866927
Actually, one true bracket style is the one true brackrt style
All hail 1tbs
>>
>>56866910
because it adds a shitton of unnecessary lines and stretches out the code, if I want to add a blank line for code readability I'll do it myself
>>
File: ((((great)))))britain.jpg (3MB, 1978x6776px) Image search: [Google]
((((great)))))britain.jpg
3MB, 1978x6776px
>>56867068
in the old times they used shitty brackets because they needed to print out the code you dumbfuck but now we dont have to spare lines.OP is fucking right.i'd rather have a readable code than stroke my cock to "hahaha my spagetti code is only 20000 lines while yours is 230000 hahahahahahha".
>>
Allman >>>>>> everything else

K&R style is harder to read
>>
>>56867625
>>56867437
one day, you might join the forces of real programmers, and you will see how young and dumb you were
>>
>Why is Allman usually not the bracket/indent style of choice?
But it is in the only language that matters nowadays, C#.
>>
File: 1310560518561.jpg (19KB, 341x487px) Image search: [Google]
1310560518561.jpg
19KB, 341x487px
>>56867437
>tv licence
>>
>>56867437
>>56867828
>tv detector vans
>search warrants
>licences are half price for the legally blind
holy shit
>>
>>56867780
>x is better because most people prefer it
>>
>>56867437
>admitting to being a shit programmer
Opinion discarded.
>>
>>56867437
finally justice after 2 years
http://www.mirror.co.uk/news/uk-news/rotherham-child-abuse-gang-victims-7451450
>>
>>56866917
this,
if (PAJEET){
pooInLoo();
}

still makes the block scope obvious
>>
>>56866910
Because people are retarded that's why. They do not know how to press enter before and
>muh extra line
>>
File: lennartplz.jpg (26KB, 665x279px) Image search: [Google]
lennartplz.jpg
26KB, 665x279px
>>56866910

>Not using superior style
>Used by authoritative projects such as systemd
>>
this may seem weird but i like keeping my braces like this

int dumbfunc(bool shit)
{
if (shit)
{ return 42; }
else
{ return 7; }
}
>>
void Foo()
{
if (Butts) Something();
else Bar();
}

2bh
>>
>>56868138
void Foo()
{
Butts ? Something() : Bar();
}
>>
>>56868157
sure that too.
>>
>>56868101
>it's actually real
No wonder pootterring is only capable of making the most ridiculously bad software known to man.
>>
//function definition
int
main(int argc, char *argv[])
{
//if statement
if(expr) {
//code
//code
}

if(one_line)
//code

return 0;
}

>>
>>56869361
THANK YOU.
>>
>>56868101
Goto fail u fucking moron
>>
>>56869361
>one line if with statement on a new line
Not a good idea
>>
constructor(
private ButtService: Butts.IButtService
){
this.Butt = ButtService.GetButt();
}
>>
>>56869361
Fuck off retard
>>
>>56866910

>not using ternary operator

Seven line statement, which should take no more than one. Plebs everywhere.
>>
File: !.png (3KB, 109x92px) Image search: [Google]
!.png
3KB, 109x92px
>>56869361
>not all code paths return a value
>>
>>56866910
const foo = a => pajeet&&(pooinloo()); !pajeet&&(bar())
>>
>>56870172
nigga stop this evaluation abuse shit a ternary is better than this
>>
>>56870056
I only ever use it when assigning to a variable.
>>
(defun foo () (if pajeet-t (poo-in-loo) (bar)))
>>
gotta be OOP
let foo = new Function('{true: Pajeet.pooInLoo(), false: Pajeet.bar}[new Boolean(Pajeet)]')
>>
File: f4rRdJbg.jpg (24KB, 276x276px) Image search: [Google]
f4rRdJbg.jpg
24KB, 276x276px
>not void poo()
>>
>>56870519
Where is the function factory service???
>>
>>56870105
But they do you fucking retard.
>>
K&R with Egyptian brackets for Java and Javascript

Kernel style for C and C++

Anything else and you should seek intercourse.
>>
>not writing all your code on a single line to make it more efficient
>>
>>56867437
>youngsters are also asked whether they feel safe using single-sex toilets
That's why there are toilets for the disabled in pretty much every school. Why don't they just fucking use them.
>>
>>56866910

I think we can at least all agree that kernel style is degenerate as fuck.

>tabs out to 8 characters
>nl brace for functions, everything else is K&R brace
>except single line conditionals, which are just one line

At least they got column width right, but jfc
>>
>>56869361
one liner ifs should really be done if you are certain that they would never change, like maybe in some small math function. Otherwise you're just making more work every time you need to add extra statements for that if.
>>
>>56872669
nl brace for functions IS K&R you goof. Also 8 character tabs is there to force people to write readable code. If there's too much nesting linus doesn't want it. It all works out because there's only one person who makes the decision if something passes or fails.
>>
>>56868101
>single line if blocks should not be enclosed in {}

hahaha, oh wow

Doesn't linux kernel coding style mention exactly the same case and says you should like it's suggested in systemd only if you're trying to something very shady?
>>
>>56867625
why is it harder to read, wasting a whole nother line for a brace makes the program itself harder to read because it will require more scrolling.
>>
Is it bad that I purposefully write all my if, for and while loops in a single line so as to do everything without the use of brackets?
>>
>brackets

ew

Superior Haskell master race here.
>>
File: 1464397674271.png (30KB, 580x283px) Image search: [Google]
1464397674271.png
30KB, 580x283px
>>56873208
Because the name and the body of the function are seperated much more clearly. The name and the parameters are on one line and the body starts on the next line, not on the same line. Pic related

>more scrolling = harder to read
That's not what harder to read means. That just means that you have to scroll more (1 line, which is fucking nothing).
>>
File: 1435798609434.jpg (142KB, 640x400px) Image search: [Google]
1435798609434.jpg
142KB, 640x400px
>>56866910
Allman only works for tiny programs. As soon as you start working on bigger projects than your everyday /dpt/ console program, the Allman style becomes unbearable.
>>
>>56874042
>(1 line, which is fucking nothing)
also 1 line for every conditional
>>
File: 1475354861508.png (17KB, 580x283px) Image search: [Google]
1475354861508.png
17KB, 580x283px
>>56874042
checkmate atheist
>>
File: 1443353985524.gif (607KB, 800x792px) Image search: [Google]
1443353985524.gif
607KB, 800x792px
 void function(int argument){
Logic();
}
>>
I used to do this shit until I realized that wasting whitespace for no reason is fucking retarded

it's the same as lining up all function/method arguments on top of each other

don't do it you fucking cunt
>>
>>56866910
It's harder to read than
void foo()
{
if (PAJEET)
{
pooInLoo();
}

else
{
bar();
}
}
>>
>>56876497
*than
void foo() {
if (PAJEET) {
pooInLoo();
} else {
bar();
}
}
Thread posts: 58
Thread images: 10


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.