this post was submitted on 08 Jun 2026
284 points (98.6% liked)

Programmer Humor

31762 readers
245 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 3 years ago
MODERATORS
 
top 50 comments
sorted by: hot top controversial new old
[–] xav@programming.dev 115 points 3 days ago (3 children)

I have decades of C++ experience. I have never met any C++ developer who hasn't shot himself in the foot regularly with this damn language.

[–] Valmond@lemmy.dbzer0.com 50 points 3 days ago (1 children)

But it's the funniest language IMO, you can do frigging anything with it.

Which is why it causes problems of course.

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

I need to find the nut meme about programming languages again

Edit: Well this meme at least gets the gist of it

[–] Valmond@lemmy.dbzer0.com 11 points 3 days ago (2 children)

Ooh been there done that, but with opengl, lol memories...

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

Ooh been there done that, but with assembly language and direct register and video memory access, lol ancient memories...

[–] Valmond@lemmy.dbzer0.com 2 points 2 days ago* (last edited 2 days ago) (1 children)

Aah!

Remember direct mode/protected mode? Mode 13? That 64k color buffer, aah memories :-)

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

Yup. All of that. And the modes got even weirder too.

[–] Valmond@lemmy.dbzer0.com 1 points 22 hours ago

Yeah there were loafs of them!

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

You get a matrix, and you get a matrix. Everything gets a matrix. That's my main memory from OpenGL.

load more comments (3 replies)
[–] copacetic@discuss.tchncs.de 28 points 3 days ago (1 children)

Most C++ devs blame themselves and not the language though. So it still gets used a lot.

[–] naeap@sopuli.xyz 12 points 3 days ago* (last edited 3 days ago) (2 children)

And I fucking love it

I hate java with a passion, C# was fun (but at that time only available through the .Net nightmare) and I grew up with (Turbo ;⁠-⁠)) Pascal and C

So, I'm feeling rather comfortable and at home with C++

I'd like to do a bigger project in Rust once at least, but with my current project already the compile times are between 20/25 to 45mins (depends, if you have the build server available or if you need to make up with the IPC).
so, I guess, those iterations would become even longer with Rust

But I'm also having the advantage, that my applications are running very, very isolated. So I don't really need to take care about exposure and attacks.

Still... Finding a memory leak or some shared memory fuck up is everything but fun...

Especially as most of the logic runs in kernel space and debugging possibilities are mostly reduced to traces/log files

Still, I love it
Maybe it's because of the thrill ;⁠-⁠)

[–] sudo@programming.dev 5 points 2 days ago (1 children)

Sounds like the same stockholm syndrome I have for Arch.

[–] naeap@sopuli.xyz 2 points 2 days ago

Arch is great in my opinion

I'm not sure, if it was just my young age/experience with Debian, but now with Arch I could always save a system. With apt I sometimes preferred a complete re-install.

I actually really like Arch(& Arch based systems).

If that is the public opinion with C++ and Arch, I'll need to re-evaluate my masochistic tendencies, it seems

[–] Valmond@lemmy.dbzer0.com 5 points 2 days ago (1 children)

As an oldtimer myself you portray it perfectly!

Cheers from another java loather 😁

[–] naeap@sopuli.xyz 4 points 2 days ago

Hehe, cheers ;⁠-⁠)

load more comments (1 replies)
[–] Soapbox@lemmy.zip 14 points 2 days ago (2 children)

I started learning C++ in high school compsci class decades ago. I still havent mastered it.

Probably because I never did any programming again after that one semester. But who knows?

[–] LodeMike@lemmy.today 3 points 2 days ago* (last edited 2 days ago)

C++ is a hat on a hat on a hat kind of language. It tries to be low level but does so many things. Learn the rule of five and that'll get you most of the way there.

[–] Anders429@programming.dev 3 points 2 days ago

I had a pretty good grasp on it when I was coding it full time, but now I wouldn't feel very confident using it. The language simply requires you to keep too much of it in your brain.

[–] SinTan1729@programming.dev 55 points 3 days ago* (last edited 3 days ago) (8 children)

My first ever big boy language was C++ (after Basic, and Logo, does anyone remember that lol). I was in middle school, tried to self-learn from learncpp.com, only to realize that I had mostly learned C, with cin-cout instead of printf-scanf. So I just decided to migrate to C. Nowadays, I mostly code in Rust, Go, and Python. But my experience with C has been extremely helpful. Can't say the same about C++ though.

[–] LedgeDrop@lemmy.zip 23 points 3 days ago (4 children)

C++ is useful for learning object oriented programming: Describing what really happens in constructors and destructors, the pros/cons of reference counting and how it actually works (using std::unique_ptr)

These are things that most modern languages try to hide/abstract away, but the underlying problems and limitations never go away, but with C++ you'll have a better understanding of why they happen.

However, if you go down the rabbit hole of Template Metaprogramming, I agree with the original post: it takes decades to learn and really only ~~useful~~ exploitable in C++.

[–] SinTan1729@programming.dev 8 points 3 days ago* (last edited 3 days ago) (2 children)

I've always preferred the functional approach to programming, so OOP never really intrigued me. That's one of the reasons why I never liked C++ or Java, but instantly fell in love with Rust. It lets me do a lot of functional style programming, while still being somewhat practical. (I'm looking at you, Haskell.)

[–] LedgeDrop@lemmy.zip 5 points 3 days ago* (last edited 3 days ago) (4 children)

I've been a long time believer that some problems are better solved via OOP, others through functional programming. The perfect language would be a successful blend of the two.

Many popular OOP languages are horribly lacking on FP or it looks like an eyesore (golang, python, etc). ...and FP languages trying to do OOP are kinda awkwards (see common-lisp).

I thought Crystal Lang (a statically type checked dialect of Ruby) was going to be the "perfect language"... but the compile time performance and the lack of 3rd party libraries (like an aws SDK) really made it hard to use.

Hearing what you said about Rust has renewed my hope.

That said, I did notice that features like Coroutines have been "experimental" for nearly 9 years.

I hope I'm missing something obvious, but how would you create any sort of heavy-lifting, long running, multi-session daemon/application without having some sort of asynchronous mechanism that goes beyond threading (which is limited to the number of cores the host machine is running).

edit: cleaned up a few thoughts (prematurely hit submit)

[–] jjj@lemmy.blahaj.zone 6 points 2 days ago* (last edited 2 days ago)

Async has been stable for a long time. Coroutines are just syntax sugar AFAIK.

[–] SinTan1729@programming.dev 4 points 2 days ago* (last edited 2 days ago) (1 children)

I don't think there's an std-way of doing it, but the Rust ecosystem has this thing where people usually settle around one library. In this case, it is tokio. Afaik, most async stuff is done using tokio. What little async I've used, it's been using tokio or some library like actix-web that uses tokio under the hood.

Also, side note, I never understood the idea of why golang is ugly. I think it's fine, except for maybe the repeated if err != nil guards. Those are ugly. I wish it used additive types for error handling.

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

As a passionate Golang hater, I can gladly explain!

  • It's not just the repeated if err != nil, even though that's already bad enough. But the really fucked up part is the := bullshit. It makes moving code around unnecessarily annoying, and it's telling that few other languages share Golang's approach.
  • The lowercase/uppercase rules for private/public stuff is theoretically not a horrible idea, but it makes the code look much more inconsistent. I find _ much easier to read, and this leaves upper/lower to signal other details. But I see that this is mostly personal preference.
  • Fairly basic operations take much, much more code than they should (e.g. deserializing JSON while handling extra args, or basic functional operations - though that should change sooner rather than later with the new generic methods, right?)
  • The decision to initialize every non-pointer primitive with the "bottom value" (or whatever it's called again) makes sense in isolation, but it's really unfortunate that they don't support additive types, because this means a bunch of common tasks need to use pointers, and unfortunately the type system is worthless when it comes to preventing segfaults caused by bugs with pointers.
  • I find that most Go libraries have basically no documentation, if you're lucky you get an example that might vaguely be related to whatever you want to know. I've had much better experiences in other languages.

All in all IMO most Go code is 5x longer than necessary to actually express itself in a readable manner, all because the language still doesn't have proper error handling or generic support (until recently at least). At the same time it's fairly inflexible, the type system is still shallow and basic, and it's still way too easy to shoot yourself in the foot.

The only good thing Go has going is the single file deployments, but I'll gladly spend one hour of every remaining day of my life setting up containers, if it means I never have to touch anything Go again.

load more comments (1 replies)
load more comments (2 replies)
load more comments (1 replies)
[–] Valmond@lemmy.dbzer0.com 2 points 2 days ago

I inherited a supposedly finalised "core" handling data, but only booleans were dealt with and I had to code the other ones. It was coded in template metaprogramming (MSVC & gcc 4.8 😨), just thinking about it gives me chills down the spine!

It's a bit fascinating (and your normal template problems if you have any will vanish and your loved one will return) but it's, IMO, not for large projects 😬. Impossible to debug (not every error is caught compile time after all).

printf was coded like that (with the variadic template "..."), I don't remember if it was libraries for the old compilers or the new ones... But that's a fun way of checking it out IMO!

[–] Feyd@programming.dev 7 points 3 days ago* (last edited 3 days ago) (1 children)

How does unique_ptr teach reference counting? It's just a way to interface with RAII and move semantics

[–] LedgeDrop@lemmy.zip 6 points 3 days ago* (last edited 3 days ago)

You're right. I was thinking of shared_ptr (it's been a blissful long while since I've dived deep into C++ stl and boost)

edit: a word

[–] YaBoyMax@programming.dev 5 points 3 days ago

I don't disagree that the language is a great way to build an understanding of object lifecycles, but in my experience C++ ctors and dtors are also the biggest source of confusing footguns I've ever encountered in any programming language.

Separately, template metaprogramming is a whole different beast. It's an extremely powerful tool, but to me it also feels like finding the correct incantation to get it to do exactly what you need for more complex scenarios. It can be really fun if you know what you're doing, but it also tends to make me very upset at the compiler when my incantations are a bit off.

[–] Valmond@lemmy.dbzer0.com 5 points 2 days ago (1 children)

Was Logo that turtle language?

[–] SinTan1729@programming.dev 4 points 2 days ago* (last edited 2 days ago)

Yes. IIRC, the flavor that I used was MSWLogo.

Try the c++23 standard. There's been a lot of cross pollination. Contrived example follows:

#include <format>
#include <numbers>
#include <print>
#include <string>

int main(int argc, char *argv[]) {
    double pi = std::numbers::pi;
    std::string fstr = std::format("{}, {:>.2}, {:>.5}, {:>.10}", pi, pi, pi, pi);
    std::string h = "Hello";
    std::string w  = "World";
    std::println("{}, {}!", h, w);
    std::print("This won't have a {},", "newline");
    std::println(" but this will add it."); // Add a newline.

    // Can't put a non-constant string as the first argument to
    // print or println so they can be checked at compile time.
    std::println("{}", fstr);
    return EXIT_SUCCESS;
}
load more comments (5 replies)
[–] red_tomato@lemmy.world 62 points 3 days ago (1 children)

The problem with C++ is that it has so many odd quirks that are difficult to learn. Sometimes these quirks are addressed - at the expense of adding new stupid quirks you need to learn.

[–] Valmond@lemmy.dbzer0.com 14 points 3 days ago (1 children)

If the c++ doesn't address it, just use the c part!! /j

[–] rain_worl@lemmy.world 15 points 3 days ago

/srs, you mean?

[–] Feyd@programming.dev 27 points 3 days ago (1 children)

C++ is my favorite language I've ever programmed in and is not even close, but I spent way too much of my time on code reviews because I couldn't trust almost anyone I worked with not to create dangling refs, memory leaks, etc

[–] plutopos@lemmy.zip 3 points 2 days ago (1 children)

Let's see how Rust fares and if it proves a valid alternative

[–] arendjr@programming.dev 8 points 2 days ago

Narrator: Rust has indeed already proven a very valid alternative.

[–] copacetic@discuss.tchncs.de 15 points 3 days ago

To be clear, the language itself is usually not the big part. You also have to learn the eco-system, libraries, packaging, debugging, etc.

(C++ is still a very "comprehensive" language though)

[–] nightwatch_admin@lemmy.world 13 points 3 days ago

C99 over all! C99! C99!

[–] mercano@lemmy.world 7 points 3 days ago (1 children)

C and C++ ask the programmer to deal with things themselves that other more modern languages do for you in the language runtime Memory management would be the big one. It’s more to wrap your head around, but if you can do it, there’s potential for more performance. In my mind, it comes down to a trade off between development time versus CPU time, and CPU time is a lot cheaper these days.

Signed, a Java dev

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