Dragon, I’ve never seen Haskell used, but it looks the most readable. I would consider using it if I didn’t think it would piss off other devs.
boo_, I formatted all my C code in High School with the GNU style. I’m not sure my teacher even read the code :P
I mostly write Lisp today, but that GNU style still has a special place in my heart. As long as it’s automatically formatted, I’m fine with whatever style, though.
SpunkyMcGoo, hot take: python using whitespace to format rather than curly braces and semicolons is cool and epic, actually
camelbeard, I’m used to K&R so no real need to switch, also my IDE by default formats in that style. Allman also looks fine, most of the others just seem to make code less readable.
AVincentInSpace, Please add this to the list of things I will fight Richard Stallman about
ChildEater, I was a K&R guy forever but I’ve been learning C++ recently (I know…) and I’ve found myself gravitating towards Allman more and more
SandLight, I started as K&R myself due to work but switched to Allman for personal stuff and I much prefer it.
1993_toyota_camry, K&R has always seemed like home to me, but I agree that Allman is pretty alright
AzzyDev, I used Allman in my C# days and the spacing always felt weird to me since i came from java :(
vale, While I respect K&R formatting, you can pry Allman from my cold, dead hands.
Feathercrown, 👍
lugal, Haskell style would be a recursive function
gandalf_der_12te, Wir sind eine diskriminierungsfreie Gemeinschaft.
9point6, Anything but K&R is psychopathic, fight me
bort, Allman if the condition is very long
<span style="color:#323232;">while(isSomething </span><span style="color:#323232;"> && isSomethingElse </span><span style="color:#323232;"> && nFoo < 10) </span><span style="color:#323232;">{ </span><span style="color:#323232;"> bla(); </span><span style="color:#323232;"> bla(); </span><span style="color:#323232;">} </span>
vs
<span style="color:#323232;">while(isSomething </span><span style="color:#323232;"> && isSomethingElse </span><span style="color:#323232;"> && nFoo < 10) { </span><span style="color:#323232;"> bla(); </span><span style="color:#323232;"> bla(); </span><span style="color:#323232;">} </span>
9point6, Hmm, I think the condition gets newlined and you K&R on the closing parenthesis IMO:
<span style="color:#323232;">while ( </span><span style="color:#323232;"> isSomething </span><span style="color:#323232;"> && isSomethingElse </span><span style="color:#323232;"> && nFoo < 10 </span><span style="color:#323232;">) { </span><span style="color:#323232;"> blah(); </span><span style="color:#323232;"> blah(); </span><span style="color:#323232;">} </span>
You could also keep
isSomething
on the first line too, but I think it’s nice to keep the whole multiline condition at the same indent width
nnullzz, This is the way.
Frozzie, No no, you’re speaking the truth
isVeryLoud, Allman is allright, anything else I agree.
pineapplelover, Isn’t Java like this? Everybody I know who codes java does it like this and I’ve been trying to follow along despite it looking stupid.
lordmauve, This bullshit is why I use Pyrhon
pkill, For concise, FP-style scripts it’s quite neat. For complex OO software? Pass
Wirlocke, I feel like I’d use Allman for large blocks of code (though in those situations it’s probably better to stick the code in a function first) and I’d use K&R for 1 or 2 lines of code (like calling a function).
timfi, We love them all <3
amotio, I was for long a long time using Kernighan style, but recently switched to Allman. Everything is suddenly more readable. It’s a journey.
Hawk, Won’t even compile in languages like Go though
amotio, Good thing I dont use Go. Primarly php for work, c# for hobby racing game in unity.
sunoc, This! Similar journey for me going from K&R to GNU!
gandalf_der_12te, <span style="color:#323232;">while (x == y) { </span><span style="color:#323232;"> </span><span style="color:#323232;"> func1(); </span><span style="color:#323232;"> func2(); </span><span style="color:#323232;">} </span><span style="color:#323232;"> </span>
notice the newline
Feathercrown, Bruh
Add comment