this post was submitted on 10 Feb 2024
207 points (96.4% liked)

196

16509 readers
2927 users here now

Be sure to follow the rule before you head out.

Rule: You must post before you leave.

^other^ ^rules^

founded 1 year ago
MODERATORS
207
Antimemes rule (lemmy.dbzer0.com)
submitted 9 months ago* (last edited 9 months ago) by [email protected] to c/[email protected]
 
you are viewing a single comment's thread
view the rest of the comments
[–] Onlytanner 33 points 9 months ago (2 children)

I had to look this up to verify that these are not only real styles, but there are/were some individuals had the gall to make other people consider these awful indentation styles. Of course it was only the C gods themselves to actually come up with something both readable and aesthetically pleasing.

All joking aside, I'd have to imagine some of these make more sense when applied to languages other than C. Even still, there is clearly one true winner in my book.

[–] [email protected] 10 points 9 months ago

Yes, I totally agree with you. There is no better style than Whitesmiths.

[–] [email protected] 6 points 9 months ago

Every C-inspired language with curly braces (which is a lot of them) that I know uses some variation on K&R/Allman.
Golang straight up enforces the "K&R" style and doesn't recognize a curly brace on a new line. I don't know of a JSON prettifier that doesn't use "K&R" style either.

Unless you mean that the Haskell/Lisp styles make more sense in Haskell/Lisp, which, yeah, obviously. Hopefully no-one actually writes C code like that.