this post was submitted on 10 Feb 2024
605 points (100.0% liked)

196

16239 readers
1782 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
(page 2) 50 comments
sorted by: hot top controversial new old
[–] ThatFembyWho@lemmy.blahaj.zone 6 points 7 months ago (1 children)

Some of those made me physically ill.

Like. You do WHAT with your whitespace?!

[–] wer2@lemm.ee 2 points 7 months ago

To be fair, some of these look very different in non-C-like languages (e.g. Lisp/Haskell).

[–] thesporkeffect@lemmy.world 5 points 7 months ago

The eternal holy wars rage on

[–] ToastedPlanet@lemmy.blahaj.zone 5 points 7 months ago (1 children)

If prefer two spaces per indention instead of tabs, but otherwise I agree with the choice of style.

[–] BeigeAgenda@lemmy.ca 5 points 7 months ago (6 children)

Tabs has no place in code, just recently I started a project with four space indentation, that quickly got changed to two.

load more comments (6 replies)
[–] BirdyBoogleBop@lemmy.dbzer0.com 5 points 7 months ago

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.

[–] Tehdastehdas@lemmy.world 5 points 7 months ago* (last edited 6 months ago)

Why would a development environment show you code in a different style from what you like? It's a simple conversion.

Why would your IDE show you code in a language other than you prefer? It's just a conversion.

Even my web browser shows any text in languages I can read, but for some reason it doesn't let me edit a document through the translation.

[–] Bienenvolk@feddit.de 4 points 7 months ago (1 children)

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.

[–] reverendsteveii@lemm.ee 4 points 7 months ago (1 children)

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".

[–] Bienenvolk@feddit.de 1 points 7 months ago

Fair enough if the GNU dudes valued consistent spacing more than taking function calls as one "logical block". Not my cup of tea but that's what configurable auto formatting is for.

[–] ThatFembyWho@lemmy.blahaj.zone 4 points 7 months ago (1 children)

And who can forget this abomination

while (x == y) { func1(); func2(); }

[–] thesporkeffect@lemmy.world 3 points 7 months ago

Aka the bash one-liner

[–] reverendsteveii@lemm.ee 3 points 7 months ago

Allman is a benign neurosis

[–] Bonsoir@lemmy.ca 3 points 7 months ago (1 children)

That's why Python has a superior syntax. There is usually one obvious way to do it, and that's the right way.

[–] 7heo@lemmy.ml 1 points 7 months ago (1 children)
[–] Bonsoir@lemmy.ca 1 points 7 months ago* (last edited 7 months ago)

4, just like the PEP8 gods intended

[–] sverit@feddit.de 2 points 7 months ago

This is the way

[–] kittykittycatboys@lemmy.blahaj.zone 2 points 7 months ago* (last edited 7 months ago)

fixed?? 😳😳

[–] zarkanian@sh.itjust.works 1 points 7 months ago

Crockford gang approves.

load more comments
view more: ‹ prev next ›