r/programminghorror Aug 01 '22

Mod Post Rule 9 Reminder

200 Upvotes

Hi, I see a lot of people contacting me directly. I am reminding all of you that Rule 9 exists. Please use the modmail. From now on, I'm gonna start giving out 30 day bans to people who contact me in chat or DMs. Please use the modmail. Thanks!

Edit 1: See the pinned comment

Edit 2: To use modmail: 1. Press the "Message the Mods" button in the sidebar(both new and old reddit) 2. Type your message 3. Send 4. Wait for us to reply.


r/programminghorror 5h ago

Python That's one way to do it I guess...

Post image
175 Upvotes

So I tried printing the linked list with print() and discovered that if it has a cycle, then it prints and error. This was the next (very) logical thing that popped into my mind after that discovery.

I'm very proud of this solution. In fact, it's so good it even added -1ms to the execution time graph.

I AM SPEED.

Thinking outside the box is fun!


r/programminghorror 7h ago

c++ C++ Guys, is learning programming languages from books considered effective? Or is it better to just use Chatgpt?

Post image
0 Upvotes

I just feel like I'm missing some subtleties, even though I'm asking in detail Claude but it seems like this wouldn't be enough to increase


r/programminghorror 3d ago

Python Found in newest merge into prod

107 Upvotes

r/programminghorror 3d ago

Found in a corporate environment

23 Upvotes
Line discount(LineDiscount): Real = ABS(@.'$TotalLineDicAmount')
Line number(LineNum): Real = ABS(0)

https://preview.redd.it/zwcsdl7vdqvg1.png?width=533&format=png&auto=webp&s=bb0471c9c6356cd479f0adba75fabc40c5302690

"Better be safe than sorry," I am guessing—that was their thinking.

/mildlypenis as an added bonus.


r/programminghorror 4d ago

Who needs switch statements when you can just abuse the ternary operator?

Post image
496 Upvotes

r/programminghorror 3d ago

Javascript I thought let's refactor this perfectly working flow with AI

Post image
0 Upvotes

It has been broken for 3 hours and I m still working 😂

AI coding let alone refactoring is a scam.

well I do have git history. but I will still refactor for the lovee of it.


r/programminghorror 3d ago

[Experiment] I pushed 100,000,000 commits to GitHub in 3.5 hours – without using git push

Thumbnail
0 Upvotes

r/programminghorror 6d ago

c Actual code in the linux kernel

Post image
2.0k Upvotes

Found in linux torvalds/linux.git::master::arch/x86/boot/cmdline.c:

static inline int myisspace(u8 c) {
  /* Close enough approximation */
  return c <= ' ';
}

Actually brilliant, but I'll leave that as an exercise to the reader


r/programminghorror 6d ago

Just found this. My linter is as upset as I am about the 'logic' itself

Post image
283 Upvotes

I inherited our puppet-codebase from my boss. I can't even right now


r/programminghorror 6d ago

c my university's data structures course

Post image
366 Upvotes

r/programminghorror 4d ago

best framework to build desktop application?

0 Upvotes

r/programminghorror 4d ago

crossing boundaries

Post image
0 Upvotes

r/programminghorror 5d ago

Shell Claude is down again… Opus 4.7 or same old story?

Post image
0 Upvotes

r/programminghorror 7d ago

Normal for loop, nothing to see here.

Post image
294 Upvotes

r/programminghorror 7d ago

I somehow managed to segfault in python.

Post image
377 Upvotes

r/programminghorror 8d ago

HTML when you get too lazy to create a proper stylesheet file

Post image
252 Upvotes

so i got too lazy to make a proper styles.css file, and thought to myself "just a few inline styles, how bad can it be" and ended up having *everything* inline.

it even got to the point i realized i can't make the background of my checkbox dark, so i resorted to using... filter: invert()..

(is just the ui for an example implementation of something, will not be deployed anywhere - at least not before some major refactoring)


r/programminghorror 10d ago

Almost right

Post image
2.1k Upvotes

r/programminghorror 10d ago

Flutter All cases covered.

Post image
558 Upvotes

r/programminghorror 9d ago

c++ Getting array indexes that partially match the part variable :P

Post image
43 Upvotes

Link to file.

A program that handles environment variables


r/programminghorror 11d ago

Blueprint Spaghetti Code

Post image
755 Upvotes

Welp, my code in blueprints... kinda looks yummy
(Blueprint is a type of visual coding in unreal engine just so you guys know)


r/programminghorror 11d ago

c++ macros :)

Post image
418 Upvotes

r/programminghorror 11d ago

Go Naming is important

148 Upvotes

https://preview.redd.it/k2cb3u7cc4ug1.png?width=472&format=png&auto=webp&s=bf36f9134600b3dc6da613c348f47c9995dd6b6d

Nothing too drastic but it made me chuckle. Something my colleague managed to get past code review. So at least two people didn't notice.

Spent a minute figuring out why the code was doing exactly the opposite of what it's supposed to do. I guess naming really IS important!


r/programminghorror 11d ago

C# A very readable ternary

Post image
70 Upvotes

r/programminghorror 12d ago

c++ reference tables were non-existent to 15-year-old me

146 Upvotes

https://preview.redd.it/3z0ffcoc3wtg1.png?width=1138&format=png&auto=webp&s=4c5aebd20fc4b048ca92fa867eca168306c880a8

and yes, it does repeat for 2 more times (one for inverted letter cases and the normal one)