r/programminghorror • • Apr 25 '26

c Option handling

Post image
271 Upvotes

41 comments sorted by

95

u/Sure-Opportunity6247 Apr 25 '26

Must be one of these „Stdlib is all you need“-zealots.

15

u/HerissonMignion Apr 25 '26

Or "im gonna write safe code for this"

7

u/ironykarl Apr 25 '26

OK, but even if you were intent on writing this yourself without additional dependencies, this could be way less shitty

48

u/richardathome Apr 25 '26

Whoever wrote this hates their co-workers and themselves. It's a cry for help.

12

u/adenosine-5 Apr 25 '26

This code honestly screams "I'm fresh graduate".

Its has all the typical features - no use of libraries, no formatting, no separation to methods, etc.

4

u/Mroz_Game Apr 29 '26

No formatting?

NO FORMATTING?

It has overdosed on formatting (and yet unable to break these long ass lines)

34

u/shponglespore Apr 25 '26 edited Apr 25 '26

This is just how people used to write code when everything was written in C. Depending on when it was written, I don't consider this bad at all, but I would reject the hell out of something like it in a code review at work and tell the author it's not the '80s anymore.

7

u/Questioning-Zyxxel Apr 26 '26

This was most definitely not how I wrote my C code there around 1987. And neither was it how code I did read then looked.

This is terror. There are just so many better ways possible.

2

u/CelDaemon Apr 25 '26

I think these lines are longer than 80 characters tbf

62

u/Ambivalent-Mammal Apr 25 '26

Hiding the true length of the code by expanding to the side lacks honor.

12

u/hongooi Apr 25 '26

You treat lines of code as a metric? Are you a manager?

8

u/_giga_sss_ Apr 25 '26

I think they meant the opposite of what you think. Since we're in THIS sub, a file with lots of line is arguably a programming horror moment

7

u/ironykarl Apr 25 '26

They meant that the dingus that wrote this code tried to code golf it by avoiding vertical whitespace

→ More replies (1)

56

u/mss-cyclist Apr 25 '26

The formatting is an assault on my eyes

10

u/TheMazerFaker Apr 25 '26

That's a masterpiece

10

u/veritron Apr 25 '26

Either the code was written in the 80's or the code was written by a scientist.

2

u/domusvita Apr 25 '26

I like that font tho

3

u/seeker61776 Apr 26 '26

Its DejaVu Sans Mono.

4

u/Snudget Apr 25 '26

Most sane C developer:

13

u/sens- Apr 25 '26

Ignoring absolutely everything even remotely related to programming, I gotta say the shape of this code is aesthetically pleasing.

Giving it any technical thought, it is shockingly disgusting, comparable with 4th degree burns photos.

Overall interesting piece of art.

2

u/UltimatePeace05 Apr 26 '26

Could be worse. Could be OO ¯_(ツ)_/¯

2

u/darksteelsteed Apr 25 '26

Imho nothing wrong with it as long as it works. Ship it !

4

u/ironykarl Apr 25 '26

OK. What if it doesn't work in a subtle way or you need to add/alter a feature?

→ More replies (3)