K&R and 1TBS is cancer

If you use K&R style or 1TBS you are part of the cancer that is killing the software industry right now.

Use Allman style like computers were intended for!
K&R style comes from a book. It was made to save on paper.
Allman is made for computers. There are no papers to save on screen.

But no, K&R had to take the indent style into actual source code:
github.com/mortdeus/legacy-cc/blob/master/last1120c/c00.c

Other urls found in this thread:

man.openbsd.org/OpenBSD-current/man9/style.9
python.org/community/
rust-lang.org/en-US/community.html
nodejs.org/en/get-involved/
swift.org/community/
perl.org/community.html
perl6.org/community/
pastebin.com/i8JJB4HS
github.com/mortdeus/legacy-cc/blob/master/last1120c/c00.c
twitter.com/NSFWRedditImage

I've gone through Python, C, C++, SQF, Lua, CSS, ASM, Batch, BASH and now JavaScript.

Allman:
function foo()
{
//where does my object start?
//where does my object end?
//doesn't take any effort
};

Saving on toilet paper OTBS:
function poo() {
//here we go
if (true) {
//where am I?
} else {
//good luck breaking yourself out of this
}
//imagine reading this 4 scopes in.
};

K&R is not for white people

For me, having an extra line for the brace is redundant. It provides me with no extra information about what I'm looking at. Since the brace is implied by the conditional statement, K&R just makes more sense to me.

Nobody cares about the extra line. The point is having matching braces aligned.

I do. Matching the closing bracket is easy because it's aligned.

No, it's aligned to the keyword, not to the opening bracket.

If you align it to the opening bracket you can immediately see the scope depth, even with invisible characters disabled.

I care about the extra line. It's redundant in my workflow. My text editor handles brace matching for me, so it does nothing for me. I might as well add an extra newline after every statement for all the good it does.

I always go for the second one, but it seems like it doesn't actually matter and is something for autists to complain about.

...

I just use Allman for C# and K&R for everything else.

The real master race is to borrow a trick from Lisp :^):
namespace Thingy { public class Whatever { public static void Main(String[] args) { Console.WriteLine("Hope you like brackets");}}}

I find it easier to read the 1st one than the 2nd. it makes no difference other than extending 1 line.

you're just autistic and it makes it harder for others to work on your code.

...

...

...

I find the one line gap in Allman style really distracting. A gap should only be used when there is a gap in thought. It's like a full-stop between sentences, if you wouldn't put a full-stop when translating to prose you shouldn't have an empty line either.

What you would write in prose:
What you would not write:
The first sentence is not complete, the statement carries through to the second one. Hence K&R is the correct translation from prose:
if faggot(OP) { print("KYS")}

Only niggers like Allman braces. Allman was a nigger. Do you want to be a nigger? Fuck you nigger.

No, it isn't.


Yeah, I like K&R better. Mostly Allman wastes space.

Extra line feeds is bloat

i use stroustrom

I write in K&R, but the Allman vs. K&R holy war has always eluded me, I don't really care. On the other hand, what kills me are the people who
These things are anthethical to one another and I'll never understand why people choose to do both/all three.

Time to weed out the subhumans here

You are all stupid and I am superior to you. Style is irrelevant when you have parsers, it's a subjective issue so just eliminate it altogether and let the machine worry about it, open code in your editor and have it auto format it in your preferred style, have it export to the style it was when you opened it when you need to, this goes for braces, indentation character(s), alignment, etc., anything that can be automatically applied.

If the existing style was too inconsistent to guess the formatting, you stab the mother fucker who wrote it and stiff him with your own style on export.

These arguments were always stupid since this has been possible for decades and it's easier now more than ever.

I usually go with the left option, but if it's short I push it into one line.

if(X) { whatever(); }

Who the fuck touched you.

shouldn't your text editor be able to parse and abstract things like allman style, OTB, and whitespace?


four spaces cocksucker.

whitespace characters != width, how do you even make that mistake when you said the first part of your post. You can have hard tabs with a width of 2 visually, as well as 4 whitespaces visually appear as just 2, or whatever width you want.

happy new years you cunts

I personally would like to use

if statement {
code
code
last code }

No wasted lines for either curly brace.

Kill yourself.

1TBS MASTER RACE REPORTING IN

HAPPY NEW YEAR TO MY 1TBS MASTER RACE BROTHERS, ALL OTHERS ARE INANE GET FUCKED SUCKERS I HOPE 2017 YEAR OF FIRE COCK BRINGS YOU ONLY PROPRIETARY SOFTWARE AND LOCKED DOWN HARDWARE.

I quit my job because of inane code style shit.

The fuck is 1tbs

1 tablespoon

CONFIRMED SUCKERS

1 terabyte storage

Allman is pure autism made by some guy with OCD who gave 0 fucks about workflow.
It's clear it's inferior, since with the same amount of lines you can see less code, it makes looking through code a painful experience, a simple if else clause that could take 4/5 lines, takes literally 8 in Allman. How can anyone defend something that could potentially transform a 1K LOC file into a 2K LOC file, completely flies over me.
I remember doing a test with some of the lazyfoo SDL2 tutorials, I converted to K&R (Plus some very minor adjustments to code) and the LoC became exactly 2/3 of what it was.
The bottom line is that braces are irrelevant, indentation already provides the information you need visually, most big projects use K&R/1TBS for a reason, and such style is even older than Allman. There was never an argument to be had here OP, you are just a faggot with a shitty opinion who probably started coding yesterday.
Doesn't matter though, you will understand at some point too, it's just a matter of time.

because I like 4 spaces of whitespace since I got used to tapping cursor keys in gedit, width or no width.

This! One more line doesn't really matter on its own, but they add up very quickly. If I remember correctly I was introduced to Allman style first, but I switched to K&R on my own before even knowing that K&R was a thing, it just made more sense to me.


Tabs for indetation, spaces for alignment. You can set your editor to display tabs as four spaces wide, eight spaces wide, two spaces wide (very useful with HTML or XML) or 13 spaces wide if you have autism.

Nextliners only want to add nonsense to their KLOC stat, so they can act like they did more work, while it's all just fluff. Nextliners are disgusting people and their code looks ugly like shit. Sameline is 10x more readable, because indentation does all the work already and you don't need to focus on every brace to see if it's an opening or closing one, while scrolling through code.

If you just want you fucking braces matched up you have autism. Fuck your cancerous autism. Autism is ruining the software industry with their OCD bullshit. God I hate autists.

Sameline for life.

All I see in this thread are attempts made by the unenlightened. Let me demonstrate the style used by gods and kings:
if(condition) statement1;if(condition) statement2;if(condition) statement3;
Without indentation there's no fighting about tabs vs spaces. Repeating the condition for each statement makes it obvious why each statement is being run.

Pure retard

The only problem with that is when you have more than one statement per condition, unless you go if(condition) statement;statement;statementwhich still causes problems if it goes past the maximum column count. Good for small if statements but defining a namespace or class like that is going to be painful.
Some languages make that even easier. Perl lets you do statement if condition;

Allman

The second and third statement will be executed regardless of the condition. You should apply for a job at Apple.

...

...

This.

/thread

use v6;unit sub MAIN;say “I left all the brackets with the fucks I give”;

Is Perl6 worth picking up now? I've been curious but I've stuck to Perl5 to let 6 mature a bit more.

KNF IS BEST
man.openbsd.org/OpenBSD-current/man9/style.9

it's like nobody but me has eyes

I can't believe there is people this idiotic

Nobody cares about matching braces.

This.
This thread is either autism or bait.

This thread is pure autism, I never knew that there are so many street shitters missaligning brackets. You fucking niggers, JUST align the fucking brackets so the code is more understandable, you won't lose any magical workflow because of that. You waste more time just reading all these posts, so if you wanna be 99.99999 productive you're doing it wrong already.

JUST ()
{
MAKE THINGS READABLE
}

Fucking code hipsters, I bet you are drinking some cappucino gay shit right now.

It's a phrase, a joke, those existed before bait

Cappucinos are NOT gay.

As long as either the semicolon or the first letter of the token matches the last brace, who gives a shit?

slash(thread){ masterrace}

...

What is this autism with aligning braces? They have no meaning for humans, they are just there to make it easier for compiler writers to tell where a block begins and ends. They are no different than the semicolon at the end of a line or the parentheses around a condition. If you want to be autistic about aligning braces you should also be autistic about aligning everything else:
if (autism ){ printf ("I'm a little sperg\n");}else if (faggotry){ fprintf(stderr, "OP here\n" ); return ;}

Or you could just treat all these compiler symbols as "invisible" and only care about the elements with relevant semantics:
if (autism) { printf("I'm a little sperg\n");} else if (faggotry) { fprintf(stderr, "OP here\n"); return;}

I tend to align things when they are tightly packed on successive lines, but there will be multiple lines of unrelated code between the opening and closing brace, so there is no point in aligning those.

K&R basically makes no sense now that editors have the ability to collapse sections. Also, people have scroll wheels now.

arguably you save 2 bytes of newline

Indent style discussion is pajeet tier: low hanging fruit on which any schmuck can have an opinion regardless of their skill and ability. No wonder it's such a popular topic in Holla Forums, along with le epick tabs vs spaces or le vim vs emacs war

It was complete fucking garbage when it was “released” (a year too soon imo) but now seems to be a sweet spot. The foundations are solid, there's miles of unclaimed land in the module system, and every other language is falling over themselves in a race to the bottom with batshit retarded technical or cultural moves.

For example, compare these pages:
python.org/community/
rust-lang.org/en-US/community.html
nodejs.org/en/get-involved/
swift.org/community/
perl.org/community.html
perl6.org/community/
Notice how Perl is (ironically) the unique and special snowflake: unlike the rest it doesn't try to shove a certain something down your throat. Perl respects you as an adult, it doesn't assume you're a retard that needs to be coddled.

if (autism){ printf("I'm a little sperg\n"); }else if (faggotry){ fprintf(stderr, "OP here\n"); return; }

How many levels of irony are you on?

It's beautiful in how much this triggers me

Yes they are, you fat drinking slut

Probably everyone in this thread is going to hate me for this but I randomly alternate styles all the time while reading my code. Sometimes I indent two spaces, sometimes 4 spaces, sometimes the whole thing is one line, sometimes it's not, I just randomly alternate as I go along for no real reason. The result is a code that looks like a mash-up of a ton of different styles.

e.g. pastebin.com/i8JJB4HS

Allman style means endless fucking scrolling all over the code for me. I hate that.

Allman is for people who write their code in something like gEdit or whatever the text editor on Windows is called instead of something like Notepad++ or Kate.

Nothing wrong with doing that in your own code, as long as you make it obvious what you're doing, and it's readable. It's still good to stick to a standard though, because jobs and big projects won't be too happy if you submit a mashup of different styles.
The general standards for programming languages is K&R for everything except C#, which is Allman. There are also a lot of languages which don't use braces like that, where the argument doesn't apply.

this and people using spaces instead of tab.

/* functions are like this */voidfoo(void){ bar();}/* conditions and loops are like this */if (foo) { bar(); baz();} else { qux();}/* or without curly braces iff both statements are one instruction only */if (foo) bar();else baz();/* spaces are only for pretty printing */long_ass_function(x, y, z, t, u, v, r, theta);

If you don't program like taught on suckless.org, you are worthless to the human species.

Who cares about any of this? The real determinants of whether your code is good are:


Doesn't matter if you put the whole thing on one line and use random strings as variable names at that point.


Why don't these languages have a "close all parens" character already? That pile of closing brackets is retarded, it's impossible to visually verify, and acts like a sand trap because many IDEs slow down cursor as it passes over brackets.


This. You stylefags are several decades late to the party. Truth is I'm just going to set my IDEs auto-formatter to whatever style I want anyway. If you try to enforce your shitty style in your project I'll just fork you and everyone will submit PRs to my more readable code instead. If you try to force me into a style at work, I'll just write it in my own style, and then use an automated tool to convert it to yours just before committing.

What is maintainability?

Are you retarded? How the fuck do you contribute or maintain? At this point I have to ask, do you actually program?
Auto formatting doesn't really work, because people will align random shit as they please, and your autoformatter will fuck tons of lines when you only wanted to modify a couple.
Seriously open any project and try to get your autoformatter to save some file just as it was, most of the time it will end up modifying some shit. Then your commit that only changes one line, will change 100. Now you have to convince everyone to use the same formatter with the same configuration, or else you are back to square one.

Admission of failure.

Holy war, the thread
sage

...

Every language should basically be python. Vertically compact and no risk of accidentally writing code that looks like it belongs to a loop but doesn't.

Not literally every language. It would be a poor fit for Lisp, for example.

Which is why he meant that every language should basically be lisp.

I like doing the {
stuff
}
because it lets me know

THING{
has shit inside it
}

vs

lineo666fcode();
lin555ofcode();
lineofc33ode();
lineofc33ode();
{
shit inside for reason
}

i guess u can read the
{
stuff
}
faster but who the fuck reads source code anyway? you write the program and people use it, no one ever gives a shit what the code is tbh as long as it works

People who need to change it. Including you.

Why are you double tabbing what the fuck is this shit?

Not to mention whitespace makes things more readable, otherwise you are reading a giant fucking wall of text.

This is shit they teach you not only in Programming, but in other places too. Resumes need to have sufficient whitespace are you are ignored. Essays have you double space lines to increase readability. etc.

Anyone who uses K&R is retarded. There is no reason not to use Allman.

K&R style will save you lines on screen, and given how laptops are typically 16:9 1366x768 crap nowadays, that makes more sense.
But I don't particularly like C language anyway. Older ones like Forth and Lisp are more interesting. But I'd rather write BASIC and assembly on 80's computer than anything on modern hardware.

Good:
if(blah) { }
if(blah)
{
}

BAD BAD BULLSHIT:
if(blah) {
}

Coding on a laptop is like masturbating with a spoon.

if condition then statement;else other statement;end if;
Everything else is worse but still ok.

I used Thinkpad R51 at work for years and it was very comfortable, with its 4:3 15-inch screen and real keyboard. No lame touchpad to get in the way either (this model only had the trackpoint at center of keyboard).
Now I have new laptop but use ergonomic USB keyboard, since everything new is designed for casuals going on facebook. Unfortunately all monitors are widescreen too, so can't do much about that.

All I see are shit styles. Ask yourself, what is the most important part of a chunk of code?

Loop statements? No.
try/catch lines? No!
Function names? Hell no!

The most important part is generally the most indented part. Therefore I only write using inverted indentation.
void truth() { for(auto i=0;i

If you're not allMAN you're either a woman or mentally ill.

...

Do you also go to Holla Forums and post "mfw I don't watch this show and I don't know what any of this means"?

No. Just for you.

Whitespace is already given by comments and the closing brace.

Allman is obviously the best indentation style.

hmm do you have a newsletter I could subscribe to perhaps?

Wrong.
Allman style is ugly on both books and computers you uncultured swine.
>github.com/mortdeus/legacy-cc/blob/master/last1120c/c00.c
That code uses old K&R style you disingenuous faggot.

ITT: People who never wrote anything useful discuss the only thing they understand.