I use Allman for control statements and K&R for declarations
I want a language that takes this and has a specification for the editor to prettify it
while x==y func1 func2
This is the way
On a serious note tho, I never understood the benefits of GNU’s spaces after functions. I don’t really mind most of the rest but I just don’t get the benefits of ‘funcname (arg)’ vs. ‘funcname(arg)’. Is there a specific reason for this? Personally, I find this to reduce readability because I have to think for a split second whether I’m looking at a variable or a function call.
Of cause this is also due to my habits, but I’m curious as to what the reasoning is.
Honestly I think it’s just “spaces before open parens” and at least it’s consistent. K&R, which I use, wants spaces before the parens in conditionals and loops but not in method sigs or method calls and the linter at work gets me almost every time I type the word “if”.
The eternal holy wars rage on
If you have ADHD, your coding style is a combination of all of these, and sometimes none of the above.
For real, this is why I enable format on save.
Allman is a benign neurosis
Allman is the only other one that has some sanity.
Allman is objective the correct choice
Allman is very practical for JSON
Allman is the way.
Always Allman. Those others give you cancer
With all due respect, 🤮
Touché!
Allman all the way.
Allman makes the code look almost academic
Academic code is specifically created to be easily understood, so I’d agree.
Go is a very opinionated language which is why I was so lucky for their opinion on this (and other things) to agree with mine.
Allmans what I learnt then went to K&R on my own because it made more sense to me. I think GNU is fine I guess, not the others though. Not that what I say matters I’ve forgotten how to code and can barely do Hello World these days.
And who can forget this abomination
while (x == y) { func1(); func2(); }
Aka the bash one-liner
Looking at them all, I don’t hate whitesmiths. Keeps all the associated block on one line which makes it a bit easier to parse
I quite like GNU
GNU style is logical, because braces are syntactically a single statement:
while (x == y) func1(); // can be replaced by { ... }
However, I prefer to entirely avoid unbraced single statements after while/if:
while (x == y) { func1(); // easy to add func2(); later }
Although this is ok when it fits:
while (x == y) func1(); // brevity!