this post was submitted on 01 Mar 2024
810 points (98.2% liked)

Programmer Humor

32143 readers
108 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 
all 22 comments
sorted by: hot top controversial new old
[–] aeronmelon@lemmy.world 100 points 7 months ago (2 children)

"Fuck, now I gotta document this without sounding like a crazy person."

[–] marcos@lemmy.world 74 points 7 months ago* (last edited 7 months ago) (1 children)
/**
 * foobar(a, b)
 * foos up a with b.
 * Note: this should never work. Fooing is impossible, and the fact that this function achieves it serves only to prove God has a wicked sense of humor.
 */
[–] devilish666@lemmy.world 17 points 7 months ago (1 children)

And then some of your noob intern tried to compile it without reading the documentation & it's worked flawlessly
Where's your god now......??

[–] marcos@lemmy.world 9 points 7 months ago

Laughing, I guess.

[–] andrew@lemmy.stuart.fun 19 points 7 months ago (1 children)

That's the final invisible panel. Code that definitely won't compile, does compile, and tests all pass.

[–] s12@sopuli.xyz 23 points 7 months ago (2 children)

WHAT THE F-

Oh! I forgot to hit ctrl-s…

[–] firelizzard@programming.dev 2 points 6 months ago

I’m in this comment and I don’t like it

[–] skulblaka@startrek.website 2 points 7 months ago* (last edited 7 months ago)

Oh I guess I'll just save this then and try ag- SEGFAULT

Thaaaat's more like it.

[–] hperrin@lemmy.world 71 points 7 months ago (2 children)

It always gives me an uneasy feeling when I try to run code I just wrote and it works the first time.

[–] merc@sh.itjust.works 24 points 7 months ago

When I first code something up, I think of it as a first draft, and I expect maybe 5ish typos / brainos per 100 lines. Only a few times in my life have I finished writing a few hundred lines of code, tried to compile / run it, and not seen at least a few errors.

When I don't see errors, it's almost always because somehow I managed to not compile / run the code at all. Like, one of my typos / brainos managed to cause it to skip that entire new block of code. Only once or twice has it happened because I actually wrote error-free code the first time. And, let me tell you, that perfect code sucked up so much more time than the more typical bad code.

With the bad code, I see the various errors, quickly fix them, and those errors convince me that the compiler / interpreter has actually seen all the new stuff and judged it. But, with perfect-from-the-start code, I now have to go in and throw in print statements, or step through a debugger to convince myself that yes, the system actually made it into that function and actually did execute those statements.

[–] nexussapphire@lemm.ee 9 points 7 months ago

It must be cosmic rays, a bit flipped while compiling. No way I got it right the first time.

[–] ShortN0te@lemmy.ml 25 points 7 months ago

Happened a few times to me. Always make sure that you have saved every file correctly and that you compile the correct project. And that there are no cached files or somewhat somewhere.

[–] NorthWestWind@lemmy.world 22 points 7 months ago (1 children)

Yes it compiles. It just throws segfaults.

[–] SinJab0n@mujico.org 5 points 7 months ago

Yup, directly to production will be.

[–] nexussapphire@lemm.ee 15 points 7 months ago

Sometimes you just need to throw shit at the fan just to see what happens.

[–] user224@lemmy.sdf.org 14 points 7 months ago

Jesus Christ, I just tried to understand the first panel for a minute as I kept reading it wrong somehow.

"Code. You think will compile, companies"

[–] nick@campfyre.nickwebster.dev 5 points 7 months ago

As a compiler developer this speaks to me on a deep level lol

[–] PoolloverNathan@programming.dev 4 points 7 months ago* (last edited 7 months ago) (1 children)
[–] marcos@lemmy.world 3 points 7 months ago (1 children)

WTF! How does that even work?

What does the compiler do when there are 5 implementations for the same name, and none fit the type system?

[–] PoolloverNathan@programming.dev 1 points 7 months ago

Raises a runtime error. (Also, overloads don't exist.)