[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/g/ - Technology


Thread archived.
You cannot reply anymore.


[Advertise on 4chan]


Quick Melanin check
>>
>>109271140
K&R or Allman.
You're a retard if you do others.
>>
>>109271150
FPBP
>>
>>109271140
I don't understand shit, I just vibe code and get shit done.
>>
>>109271150
Allman is my style, it's leaner than K&R but most zoomers use K&R nowadays in their project so yeah....
>>
>>109271140
White men don't code in dark mode
>>
>>109271140
Allman, easiest to read
>>109271165
you're not white, Anurag
>>
File: 1784030244490.jpg (45 KB, 474x457)
45 KB JPG
>>109271157
>I don't understand shit, I just vibe code and get shit done.
>>
>>109271140
>Hotstmann
>Haskell
>Lisp
lmao wtf
>>
allman bros. don't need to conserve lines on paper anymore
>>
Allman with 2 spaces for indentation
However I am only polish and not a true white man like Ryan Fleury using Allman with 1 space indentation.
>>
I write ( condition ) in D - that is, with additional space after the opening ( and before the closing ). Makes it more readable and visually distinguishes it from a function call. People will shit on it, but it feels comfy.
>>
>LISP
>{
>}
>>
>>109271140
this is what nocoders spent time on
>>
>>109271140
Allman
Ordnung muss sein.
>>
>>109271140
low iq check
>>
>>109271140
Haskell style is master race.
>>
>>109271140
K&R if you actually code.
Allman if you like pretty things but can't code.
Every else: mental illness.
>>
>>109271189
Haskell and Lisp style don't make sense for C style languages.
if you formatted lisp like the others you'd have a shitload of empty line of delimiter closing and in Haskell, it makes more sense when you don't use trailing delimiters, like in json:

{ "x": "Y"
, "Z": "A"
}


so you can add new members without accidentally adding trailing delimiters. in programming like rust, ocaml, haskell or even powershell ( lmao ), the last expression without termination is returned so it also makes sense there.
>>
explain why this is wrong without appealing to emotion

while (
x == y
) {
foor();
bar();
}
>>
>>109271611
It's not wrong if your screen is 7 columns wide.
>>
>>109271140
K&R if you're writing a book and want to save space.
Allman if you actually code.
Every else: mental illness.
>>
>>109271611
My screen has more horizontal space than vertical space
>>
>>109271644
>>109271617
>>109271611
optimal style for vertical monitors?
>>
>>109271140
Allman for functions. K&R for everything else. This is objectively correct.
>>
>>109271653
Probably Allman but splitting lines for each separate condition on long statements. Also being better than vibecoders and not nesting 30 loops inside one another
>>
>>109271140
BSD Kernel Normal Form
https://man.openbsd.org/style.9
>>
>>109271140
K&R or Allman, depending on the established language/project standard.
>>
>>109271140
gnu
>>
>>109271140
I do K&R because it's what I've always done, but I kind of like GNU too
>>
When I was a noob, I preferred Allman.
When I was a midwit (college), I preferred K&R.
Now that I have profound technical knowledge of C and its syntax, I prefer GNU. GNU is the one that makes most sense in light of how the C grammar is structured.

All the others are icky-faggot-tier.
>>
>>109271140
anything but allman is a mental illness. typography is a well established science.
>>
>>109271140
K&R or Allman, the others are all trash. The Haskell one is a meme, and Lisp is great — for Lisp.
>>
File: 1780956556198046.jpg (67 KB, 778x480)
67 KB JPG
>>109271763
>>
File: 1756708555521551.png (32 KB, 240x240)
32 KB PNG
>>109271140
if x = y then
foo;
bar;
end if;
>>
>>109271140
>APL
while (x == y) { foo(); bar(); }
>>
>>109271140
It doesn't fucking matter. i just follow whatever is the default for the current language. Such details don't matter and it's a sign of low intelligence to worry about this shit too much rather than thinking about code.

That being said, everything but K&R or Allman looks bad. That Haskell one has to be a joke.
>>
>>109271140
In a single line.
while (x == y) { foo(); bar(); }

It looks ugly in a single line because C, like many languages, is ugly.
>>
>>109271150
fpbp
>>
>>109271140
My code is all k&r, 35 years of it.
>>
K&R >= Allman > GNU == Lisp > Horstmann > Haskell.
>>109271159
>it's leaner than K&R
How so? It's an extra new line.
You could argue that is separates out what each line is saying, if splitting the condition from saying "I am starting a code block" is important to you, but it's not leaner.
As long as we can all gang up on the rest though (especially Haskell) I don't mind whether someone uses K&R or Allman.
>>
>>109272012
If its one action its pretty
 while (x == y) foo(); 
>>
>>109271150
yep
>>
GNU is best, like always
>>
>>109271140
Holy shit, does Haskell really:

thing
;
; thing

?

>>109271150
I could see the case for Horstmann if you simply don't give a shit about organization, but yeah, those two make code look clean.

I guess GNU would be similar to Allman (not seeing a huge difference between the two).
>>
i don't use while loops
>>
K&R. One line when folded
>>
>>109271140
Only the ones on the left are not meme formatting.
>>
>>109271140
whatever style the repo is already using (usually K&R)
>>
>>109271140
while (x == y)
foo(), bar();
fuck brackets
>>
>>109273365
this. vote GNU no matter who
>>
>>109271140
while x == y: 
foo
bar
>>
>>109271140
allman for function definitions in case i decide split the parameters on a new line k&r for everything else
>>
i am a disgusting fat chud
let rec loop () = 
if x = y then (
foo ();
bar ();
loop ())
;;

let () = loop ();;
>>
File: 17817558996620962.webm (3.99 MB, 720x1280)
3.99 MB
3.99 MB WEBM
f = (x,y) => x == y ? (foo(); bar(); f(x,y)) : _
>>
>>109271611
It's immoral for parenthesis to not touch anything
>>
>>109275496
I thought those were BBC legs wrapped around her.
Bros... Am I completely mindbroken?
>>
>>109275564
no, that's completely normal. I thought that as well since all women are made for BBC.
>>
>>109275564
if you're not a pajeet, take a break from porn.
>>
>>109271150
GNU only does this so that they can pretend their code isn't stolen from AT&T
all the rest are braindead
>>
>>109272273
looks like trying to hide something or creating a pothole for someone else to clean up adding another statement
just
while (x==y)
{
foo();
}

that shit nigga it's like a whole 4 extra keypresses don't be lazy
>inb4 it's the next guy's problem/future me's problem fuck that guy
>>
>>109272273
look up the crapple goto fail bug.
>>
File: 1775847011161596.mp4 (1.15 MB, 480x564)
1.15 MB
1.15 MB MP4
>>109275673
>no, that's completely normal. I thought that as well since all women are made for BBC.
>>
>>109271150
>>109271159
K&R looks nicer imo, but Allman is easier to edit.
>>
>>109271150
fpbp
I'm known to use Allman but K&R is the way.
wtf is happening with Haskell, good lord
>>
K&R because that's how I learned, Allman is nice too. GNU is autistic but understandable. The rest are mental illness.
>>
>>109271140
K&R for Java, Allman for C#.
>>
>>109271202
>spaces for indentation
utterly insane
>>
while x == y
foo
bar
>>
>>109271611
I like this when I have lots of conditional statements. Boolean operators at the beginning of the lines.
>>
>>
>>109278066
the fuck, post your keyboard
>>
File: 20260715_002756.jpg (746 KB, 4080x3060)
746 KB JPG
>>109278072
>>
>>109278107
that doesn't even have tall braces
>>
>>109278112
Well, I get the characters from kcharselect and use vim. Here are, for your convenience, some relevant characters:












But that will likely get mangled, so here's them encoded:

print(str(b'\xe2\x8e\x9b\xe2\x8e\x9e\xe2\x8e\xa1\xe2\x8e\xa4\xe2\x8e\xa7\xe2\x8e\xab\xe2\x8f\x9e\n\xe2\x8e\x9c\xe2\x8e\x9f\xe2\x8e\xa2\xe2\x8e\xa5\xe2\x8e\xa8\xe2\x8e\\
xac\xe2\x8f\x9f\n\xe2\x8e\x9c\xe2\x8e\x9f\xe2\x8e\xa2\xe2\x8e\xa5\xe2\x8e\xaa\xe2\x8e\xae\n\xe2\x8e\x9d\xe2\x8e\xa0\xe2\x8e\xa3\xe2\x8e\xa6\xe2\x8e\xa9\xe2\x8e\xad\n\n\xef\
\xb8\xb7\n\xef\xb8\xb8\n\n\xe2\x95\xad\xe2\x94\xb4\xe2\x94\x80\xe2\x95\xae\xe2\x8e\xb4\n\xe2\x94\xa4 \xe2\x94\x82\xe2\x8e\xb6\n\xe2\x94\x82 \xe2\x94\x9c\xe2\x8e\xb5\n\x\\
2\x95\xb0\xe2\x94\x80\xe2\x94\xac\xe2\x95\xaf', encoding='utf-8'))
>>
>>109271140
K&R by default
Allman if the expression goes across multiple lines
e.g.
if thing(happened)
&& other_thing(did_not_happen)
{
do_next_thing();
}

(I write Rust btw)
>>
>>109278158
...let's try that again:
b = b'\xe2\x8e\x9b\xe2\x8e\x9e\xe2\x8e\xa1\xe2\x8e\xa4\xe2\x8e\xa7\xe2\x8e\xab\
\xe2\x8f\x9e\n\xe2\x8e\x9c\xe2\x8e\x9f\xe2\x8e\xa2\xe2\x8e\xa5\xe2\x8e\xa8\xe2\
\x8e\xac\xe2\x8f\x9f\n\xe2\x8e\x9c\xe2\x8e\x9f\xe2\x8e\xa2\xe2\x8e\xa5\xe2\x8e\
\xaa\xe2\x8e\xae\n\xe2\x8e\x9d\xe2\x8e\xa0\xe2\x8e\xa3\xe2\x8e\xa6\xe2\x8e\xa9\
\xe2\x8e\xad\n\n\xef\xb8\xb7\n\xef\xb8\xb8\n\n\xe2\x95\xad\xe2\x94\xb4\xe2\x94\
\x80\xe2\x95\xae\xe2\x8e\xb4\n\xe2\x94\xa4 \xe2\x94\x82\xe2\x8e\xb6\n\xe2\x94\
\x82 \xe2\x94\x9c\xe2\x8e\xb5\n\xe2\x95\xb0\xe2\x94\x80\xe2\x94\xac\xe2\x95\xaf'
print(str(b, encoding='utf-8'))

https://pastebin.com/raw/QDWrG6th (apparently simple text files are beyond catbox.moe's comprehension.)
>>
>>109271140
GNU so you can contribute to GNU software
>>
>>109271140
Whatever the default formatter for my language uses
>>
>>109272264
Sorry i meant cleaner not leaner, i lost C somewhere ... maybe it's time to move to D or nim ...
>>
>>109271140
>Allman or K&R
easy to write by hard
>everything else
you have a sudden need for an auto formatter now
>>
>>109271611
i do that when i have a few longish conditions in an if statement
the worst part about it is fighting the auto indentation
>>
>>109271140
Allman and KR are conventions, the rest are mental illnesses.
>>
>>109271140
what a pointless thread who cares lmao
>>
>>109273378
>I guess GNU would be similar to Allman (not seeing a huge difference between the two).
GNU indents the braces.
>>
>>109271140
I love allman and hate the rest. I accept K&R as a reality I have to live with.
Better question. If you didn't have to adhere to language specifics, what case would you use for what?
>>
>>109271611
It makes me angry
>>
>>109278790
Ah I see. Fair enough.
>i lost C somewhere ... maybe it's time to move to D or nim ...
But then it would be Dleaner or nimleaner and that way madness lies.



[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.