this post was submitted on 16 Mar 2025
787 points (98.2% liked)

Programmer Humor

21680 readers
97 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
787
C++ (ani.social)
submitted 4 days ago* (last edited 4 days ago) by kiri@ani.social to c/programmer_humor@programming.dev
 
top 50 comments
sorted by: hot top controversial new old
[–] JATtho@lemmy.world 4 points 2 days ago

I once wrote bind_front() and move_only_function likes in C++17. This nearly drove me mad because you cannot refer to a overload set by a name.

On the otherhand, I can now decipher the template error mess that the (g++) C++ compiler spews out.

[–] brucethemoose@lemmy.world 136 points 4 days ago* (last edited 4 days ago) (2 children)

Meanwhile, Rust punches you in the face for the mere suggestion. Again. And again.

Python happily nods, runs it one page at a time, very slowly, randomly handing things off to a C person standing to the side, then returns a long poem. You wanted a number.

Assembly does no checking, and reality around you tears from an access violation.

EDIT: Oh, and the CUDA/PyTorch person is holding a vacuum sucking money from your wallet, with a long hose running to Jensen Huang's kitchen.

[–] stingpie@lemmy.world 11 points 3 days ago (2 children)

I refuse to believe the python one ever happens. Unless you are importing libraries you don't understand, and refuse to read the documentation for, I don't see how a string could magically appear from numeric types.

[–] expr@programming.dev 4 points 2 days ago (1 children)

You don't see how type mismatch errors can happen in a dynamically-typed language? Then why do they happen all the time? Hell, I literally had a Python CLI tool crash with a TypeError last week.

[–] stingpie@lemmy.world 3 points 1 day ago (1 children)

That's not what I'm saying at all. What I'm trying to say is that I can't think of any way a program working with numeric types could start outputting string types. I could maybe believe a calculator program that disables exceptions could do that, but even then, who would do that?

[–] expr@programming.dev 1 points 1 day ago

The point of the joke is not that the Python interpreter will change types mid-program on its own, but that you don't have any real way of knowing if you're going to get the type you expect.

Programs are messy and complicated, and data might flow through many different systems before finally being used for output. It can and often does happen that one of those systems does not behave as expected, and you get bugs where one type is expected but another is used in actuality.

Yes, most likely what would happen in Python is a TypeError, not actual output, but it was pretty clearly minor hyperbole for the sake of the joke.

load more comments (1 replies)
[–] caseyweederman@lemmy.ca 37 points 3 days ago (1 children)

Rust just keeps telling me "you didn't actually learn how references work" over and over

[–] SatouKazuma@programming.dev 12 points 3 days ago

Lifetime annotations go brr

[–] count_dongulus@lemmy.world 64 points 3 days ago (7 children)

This is why I will never touch Javascript again. Long ago when I worked on web stuff, half my workflow was spent in the debugger tracing garbage to find where a typo was. The industry moved to Typescript, and now assuming the strictness checks are enabled, if some Typescript transpiles successfully, I can be 95% sure whatever fuckup I observe at runtime is a logic problem.

Weakly typed languages were an awful idea. But in general, if the compiler isn't able to detect most runtime issues (like with C++ here), it's not going to be the most productive language to use for building solutions compared to smarter alternatives.

load more comments (7 replies)
[–] riodoro1@lemmy.world 84 points 4 days ago (3 children)

Am I bad at programming?

No, it’s the language thats wrong.

[–] RoyaltyInTraining@lemmy.world 94 points 4 days ago (11 children)

Except that many other languages have proven that C++ is simply terrible at providing meaningful errors.

load more comments (11 replies)
[–] asdfasdfasdf@lemmy.world 21 points 3 days ago (1 children)

I mean, this is correct in many cases, unironically.

It should be one of the core purposes of a programming language to help humans to write the code they intend. If a language doesnt do that then it's bad.

[–] Shanmugha@lemmy.world 1 points 2 days ago* (last edited 2 days ago) (1 children)

I tend to disagree. The language should allow me to do things, and what is simple and obvious logically should be simple and obvious in the language (I am looking at you, JavaScript with [] != [])

What I intend - well, more than half my work is figuring out what I intend, language should have no say in this, save things like "we do this kind of trick like this here" (for example, C++ has no concept of "interface" entity. Ok, looks like I can use virtual class instead)

It is when languages start trying to be "helpful" they become an ugly mess: meaningful white spaces in Python? The whole shit with prototypes and objects in JS(see above)? Fuck this shit, I am not going to call those two good programming languages

[–] asdfasdfasdf@lemmy.world 3 points 2 days ago* (last edited 2 days ago) (1 children)

I think you're saying the same thing as what I am. If it's more complex than what you may think, the language should guard against it. If not, it should make it simple.

Rust, for example, is the only mainstream language where it isn't possible to read from a file handle after it's been closed. Doing so is a compilation failure. This is just a general invariant of "how to use files".

But you also don't need to think about allocating or deallocating memory in Rust. It does that fke you automatically, even though it's not GC.

JS can also be complicated when it tries to hide realities about the world. E.g. is a const array or object immutable? No, the pointer is. But pointers don't exist! /s

[–] Shanmugha@lemmy.world 1 points 2 days ago (1 children)

Looks like we still differ. If something is more complicated than what I may think, then there are some possibilities:

  • I have not learned to language properly yet (this is where I stand with C++, so no matter how many times I've got segfaults, now is not the time for me to say language is bad)
  • I have chosen the wrong tool (writing a videoplayer in assembler? something went way wrong here)
  • tool is actually bad (my rant above goes here. in the sake of making some things easy and simple, something basic in the language got screwed up irrevocably)

And if I managed to try reading from a closed handle, or to access a memory that I am not actually allowed to use, or... (could not get more examples out of the top of my head), it is not the job of the language to slap my hands, as long as I follow the syntax. Most of the time (if not all the time) this means I have not accounted for something that my code allowed to happen - so my responsibility to deal with that

What I keep hearing about Rust is still in the lines of too-much-fucking-care (that's besides obviously dumb rule of "no more than one owner of a variable at any moment" which then had to be worked around because not everything can be done this way. please correct me if I am wrong here)

[–] asdfasdfasdf@lemmy.world 2 points 2 days ago (1 children)

Yep, we disagree. The world and technology especially is an extremely complicated place. IMO any complex system that is built upon "humans should just know all this complexity and keep it in mind all the time" is fundamentally broken.

[–] Shanmugha@lemmy.world 1 points 2 days ago* (last edited 2 days ago)

It depends. We may have our differences in weighing things, but yes, complexity of the system must correlate with complexity of the task it is used for. A system allowing to do things without any complexity means either no complex things to be done or straight up magic

[–] pimento64@sopuli.xyz 17 points 3 days ago (1 children)

Valid languages:

  1. HolyC

That's it

load more comments (1 replies)
[–] henfredemars@infosec.pub 68 points 4 days ago (5 children)

Ah, C++. An endless supply of footguns where the difference between a junior and a senior dev is knowing what parts of the language to never use.

[–] xmunk@sh.itjust.works 25 points 4 days ago (2 children)

Real C++ programmers pass by const ref and tell pointers to fuck off.

[–] henfredemars@infosec.pub 15 points 3 days ago* (last edited 3 days ago) (4 children)

You can also make everything a smart pointer and be done with it.

I can count on more than one hand the number of large scale projects where converting everything to smart pointers fixed major memory issues. Even if smart pointers can’t handle circular references, the number of projects that just don’t manage their memory correctly at all and were fixed by introducing these tools is way too high.

load more comments (4 replies)
load more comments (1 replies)
load more comments (4 replies)
[–] Lemmist@lemm.ee 47 points 4 days ago (3 children)

So? Do you really expect the compiler to UNDERSTAND the code?

Here is a grammatically correct phrase for you to think:

Compilers don't paint tangential apostrophes unless the storm value is deeper than radish. Fraggles love radish.

[–] LaggyKar@programming.dev 44 points 4 days ago (10 children)

This is something that Rust is specifically designed to prevent.

load more comments (10 replies)
[–] aliceblossom@lemmy.world 39 points 4 days ago (3 children)

Man, fraggles really do love radish though.

load more comments (3 replies)
[–] LPThinker@lemmy.world 20 points 3 days ago (1 children)

Congratulations, you've illustrated the difference between syntax and semantics. But any competent compiler also handles semantics (just in a separate phase of compilation), because that's necessary for any useful conversion to machine code, not to mention optimizations.

load more comments (1 replies)
[–] ICastFist@programming.dev 25 points 3 days ago (4 children)

What surprised me the most was the speed of the compilation, must be a very small program. I tried to compile Godot from source once. Force-stopped it after 3 hours

[–] scholar@lemmy.world 41 points 3 days ago

There's a reason the play is called waiting for Godot

[–] Sylvartas@lemmy.dbzer0.com 10 points 3 days ago (4 children)

How many cores do you have and what compiler was it ? Also RAM can help with huge codebases iirc. When I was working with UE5 I had the best Ryzen available with 128 Go of RAM, could compile the engine (which is much bigger than Godot) from source in less than 2 hours iirc (yes that is a full clean+rebuild, not just compiling recent changes)

load more comments (4 replies)
load more comments (2 replies)
[–] Thorry84@feddit.nl 35 points 4 days ago

Typescript on the other hand: Exwuse me sir, you seem to have a little oopsie right here. Oh right! Let me just fix that right up.

HERE ARE TWO THOUSAND ERRORS! YOUR PUNY LITTLE BUFFER CAN'T EVEN SCROLL BACK TO READ THEM ALL! AND YOU CALL YOURSELF A PROGRAMMER?

[–] zero_spelled_with_an_ecks@programming.dev 28 points 3 days ago (6 children)

Just me or is the single speech bubble loop in the 4th panel weird?

[–] can@sh.itjust.works 22 points 3 days ago

Very. It's like they're both saying it in unison.

load more comments (5 replies)
[–] abcd@feddit.org 23 points 3 days ago

Is C++ the first enemy that managed to win against one punch man?

[–] heavy@sh.itjust.works 16 points 4 days ago (3 children)

I mean, the comic is fine I guess, but if it implies the Cpp lady is hitting you, it's not. That would be the kernel, the lady did what you told her to do.

[–] senkora@lemmy.zip 13 points 3 days ago

If undefined behavior is triggered anywhere in the program, then it is allowed by the standard for the process to ask the anthropomorphized compiler to punch you.

100% based and standards-compliant comic

load more comments (2 replies)
load more comments
view more: next ›