this post was submitted on 22 Jul 2025
429 points (98.2% liked)

Programmer Humor

25328 readers
1109 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS
 

I don't think that casting a range of bits as some other arbitrary type "is a bug nobody sees coming".

C++ compilers also warn you that this is likely an issue and will fail to compile if configured to do so. But it will let you do it if you really want to.

That's why I love C++

(page 2) 50 comments
sorted by: hot top controversial new old
[–] americanzgenozida@thelemmy.club -2 points 5 days ago

Did you know 100% of C programmers were sex offenders?

[–] deegeese@sopuli.xyz 131 points 1 week ago (1 children)

C lets you shoot yourself in the foot.

C++ lets you reuse the bullet.

[–] mindbleach@sh.itjust.works 39 points 1 week ago

C is dangerous like your uncle who drinks and smokes. Y’wanna make a weedwhacker-powered skateboard? Bitchin’! Nail that fucker on there good, she’ll be right. Get a bunch of C folks together and they’ll avoid all the stupid easy ways to kill somebody, in service to building something properly dangerous. They’ll raise the stakes from “accident” to “disaster.” Whether or not it works, it’s gonna blow people away.

C++ is dangerous like a quiet librarian who knows exactly which forbidden tomes you’re looking for. He and his… associates… will gladly share all the dark magic you know how to ask about. They’ll assure you that the power cosmic would never, without sufficient warning, pull someone inside-out. They don’t question why a loving god would allow the powers you crave. They will show you which runes to carve, and then, they will hand you the knife.

[–] Contramuffin@lemmy.world 93 points 1 week ago (2 children)

What do you mean I'm not supposed to add 0x5f3759df to a float casted as a long, bitshifted right by 1?

[–] panda_abyss@lemmy.ca 90 points 1 week ago (31 children)

I actually do like that C/C++ let you do this stuff.

Sometimes it's nice to acknowledge that I'm writing software for a computer and it's all just bytes. Sometimes I don't really want to wrestle with the ivory tower of abstract type theory mixed with vague compiler errors, I just want to allocate a block of memory and apply a minimal set rules on top.

load more comments (31 replies)
[–] eager_eagle@lemmy.world 58 points 1 week ago

C++: all the footguns you need plus a lot more that you never imagined in a single language

[–] magic_lobster_party@fedia.io 55 points 1 week ago (8 children)

There are no medals waiting for you by writing overly clever code. Trust me, I’ve tried. There’s no pride. Only pain.

[–] Zacryon@feddit.org 3 points 6 days ago

But I must o p t i m i z e! ó_ò

Yes, let's spend two hours on figuring out optimal values of preallocating a vector for your specific use-case. It's worth the couple of microseconds saved! Kleinvieh macht auch Mist.

[–] Chrobin@discuss.tchncs.de 25 points 1 week ago (3 children)

It really depends on your field. I'm doing my master's thesis in HPC, and there, clever programming is really worth it.

load more comments (3 replies)
load more comments (6 replies)
[–] pennomi@lemmy.world 37 points 1 week ago (1 children)

C++ is kinky that way. You can consent to all manner of depraved programming patterns. Great for use in personal life, but maybe not appropriate for the office.

[–] Korne127@lemmy.world 53 points 1 week ago (3 children)

But does it have cargo-mommy :P

load more comments (3 replies)
[–] wer2@lemmy.zip 32 points 1 week ago (1 children)

My issue is C++ will "let me do it", and by that I mean "you didn't cast here (which is UB), so I will optimize out a null check later, and then segfault in a random location"

load more comments (1 replies)
[–] UnfortunateShort@lemmy.world 26 points 1 week ago* (last edited 1 week ago) (2 children)

I used to love C++ until I learned Rust. Now I think it is obnoxious, because even if you write modern C++, without raw pointers, casting and the like, you will be constantly questioning whether you do stuff right. The spec is just way too complicated at this point and it can only get worse, unless they choose to break backwards compatibility and throw out the pre C++11 bullshit

[–] Zacryon@feddit.org 2 points 6 days ago (1 children)

I suppose it's a matter of experience and practise. The more you wotk with it the better you get. As usual with all things one can learn.

load more comments (1 replies)
load more comments (1 replies)
[–] BigDanishGuy@sh.itjust.works 25 points 1 week ago (12 children)

But it will let you do it if you really want to.

Now, I've seen this a couple of times in this post. The idea that the compiler will let you do anything is so bizarre to me. It's not a matter of being allowed by the software to do anything. The software will do what you goddamn tell it to do, or it gets replaced.

WE'RE the humans, we're not asking some silicon diodes for permission. What the actual fuck?!? We created the fucking thing to do our bidding, and now we're all oh pwueez mr computer sir, may I have another ADC EAX, R13? FUCK THAT! Either the computer performs like the tool it is, or it goes the way of broken hammers and lawnmowers!

[–] pipe01@programming.dev 1 points 5 days ago

New copypasta just dropped

[–] Shanmugha@lemmy.world 1 points 5 days ago

Yup, I am with you on this one

[–] Throskie@midwest.social 2 points 6 days ago* (last edited 6 days ago)

This comment makes me want to reformat every fucking thing i use and bend it to -my- will like some sort of technomancer

load more comments (9 replies)
[–] who@feddit.org 20 points 1 week ago

Thank you for including the text as text.

load more comments
view more: ‹ prev next ›