this post was submitted on 15 May 2024
588 points (97.0% liked)

Programmer Humor

19623 readers
2719 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 1 year ago
MODERATORS
 
all 50 comments
sorted by: hot top controversial new old
[–] MajorHavoc@programming.dev 61 points 6 months ago (2 children)

I do really like C++.

And yes, this would work.

[–] marcos@lemmy.world 0 points 6 months ago (3 children)

All the noise I see is from people insisting that Rust developers are noisy, and their favorite language is much better types-don't-solve-bugs-undefined-behavior-is-fine-and-memory-errors-are-not-a-problem.

Actual Rust developers have been silent for years.

[–] MajorHavoc@programming.dev 44 points 6 months ago (2 children)

I once shared that I had a bad first experience with Rust and no less than four Rust developers arrived to inform me that I was either hallucinating, or bad at programming, or both.

I haven't had this much fun winding up a sensitive community since I shared how I really felt about Java Spring, in it's heyday.

[–] pooberbee@lemmy.ml 34 points 6 months ago (2 children)

I suspect there are a lot of "Rust devs" that are little more than kool-aid drinkers. Common refrains are that Rust is the fastest language, most type-safe language, and most powerful language. Rust certainly seems to move the state of the art forward in some ways, but you can still write garbage code in it.

I've worked with lots of different people in lots of different languages, and I think I'd rather good people in a bad language than the other way around by a mile.

[–] realbadat@programming.dev 15 points 6 months ago

Pfft, that's only because you write garbage code in rust.

I write garbage code in lots of languages!

[–] sleeplessone@lemmy.ml 4 points 6 months ago

You can write garbage code in rust, but the compiler will beat you with a stick for doing so.

[–] veroxii@aussie.zone 26 points 6 months ago (1 children)

Bloody hell mate. A little bit of warning before so casually dropping Java Spring out there.

[–] MajorHavoc@programming.dev 12 points 6 months ago

Sorry. I'll use the content warning format next time.

[–] WhiskyTangoFoxtrot@lemmy.world 21 points 6 months ago

I tend to stick to interpreted languages so I can't weigh in on the Rust vs. C++ debate, but I know that if you're trying to make headway against a language as entrenched as C++ is you've got to get loud.

[–] Maven@lemmy.zip 20 points 6 months ago

As a rust dev myself... It's my right to be obnoxious

[–] lambalicious@lemmy.sdf.org 0 points 6 months ago

Many Rust shills seem to have some rust in their brain...

[–] noxy@yiffit.net 54 points 6 months ago

These trolley problem memes are getting harder and harder to understand

[–] ptz@dubvee.org 48 points 6 months ago* (last edited 6 months ago) (2 children)

Seems like solar power with extra steps lol.

(Sun -> Plants -> Food for people/other food)

[–] cameron_@lemmy.world 39 points 6 months ago (4 children)

Technically speaking, pretty much all of our power is solar power with extra steps.

[–] ptz@dubvee.org 13 points 6 months ago

True. All just inefficient ways of harnessing fusion power.

[–] lambalicious@lemmy.sdf.org 12 points 6 months ago

You are technically correct. The best kind of correct.

[–] Duke_Nukem_1990@feddit.de 4 points 6 months ago (1 children)
[–] emergencyfood@sh.itjust.works 9 points 6 months ago (1 children)

The sun powers the water cycle.

[–] Duke_Nukem_1990@feddit.de 5 points 6 months ago

Not the tides 🤔

[–] SpaceNoodle@lemmy.world 13 points 6 months ago

Rust developers don't need food, they thrive on their smug sense of superiority over C++ developers

[–] samus12345@lemmy.world 24 points 6 months ago (1 children)
[–] CluckN@lemmy.world 14 points 6 months ago (1 children)

Proof that the meme was written by a dev

[–] EmoDuck@sh.itjust.works 12 points 6 months ago

Proceeds to spend 3 hours bug fixing until you realize that you spelled list as lsit

[–] luciole@beehaw.org 22 points 6 months ago (3 children)

How do you produce the coffee to power the rust users?

[–] lambalicious@lemmy.sdf.org 17 points 6 months ago

Aren't they powered by the sheer spite they generate at hearing the loudspeaker?

[–] Sylence@lemmy.dbzer0.com 9 points 6 months ago

Believe it or not, also the sun!

[–] MajorHavoc@programming.dev 1 points 6 months ago

That's the critical question!

[–] Dave@lemmy.nz 22 points 6 months ago

Does the solar power the speaker and the turbine is the power generation? Does this turbine produce more power than the solar powering the speaker?

[–] ScreaminOctopus@sh.itjust.works 19 points 6 months ago (3 children)

Tbf, does anyone actually "like" C++?

[–] suy@programming.dev 19 points 6 months ago (1 children)

Yes. There is already an answer with many votes saying so, but I'll add myself to the list.

I don't have to like all the language, and not even all of the standard library. I learnt C++ with the Qt library, and I still do 99% of my development using Qt because it's the kind of software that I like to write the most. I can choose the parts that I like the most about the full C++ ecosystem, like most people do (you would have to see how different game development is, for example).

I'm also learning Rust, and I see nothing wrong with it. It's just that I see C++ better for the kind of stuff that I need to write (at this time at least).

[–] refalo@programming.dev 2 points 6 months ago (1 children)

personally I just can't get over the syntax to even try rust. to me it just looks terrible. I know not everybody agrees though. that and having even longer compile times and no mature gui framework

[–] ScreaminOctopus@sh.itjust.works 1 points 6 months ago

IMO the syntax is fine except for the borrow checker shit that just looks arcane. The fact that everything cargo drags in is statically linked really turns me off the language for anything serious. It's really unfortunate because I'd otherwise put some time into learning it, but it seems like the rust foundation is fine with this (ridiculous IMO) workflow.

[–] Lobreeze@lemmy.world 6 points 6 months ago

I don't mind it

[–] frezik@midwest.social 5 points 6 months ago

I like a subset of C++ that's sane enough to grapple with.

[–] SleveMcDichael@programming.dev 14 points 6 months ago (2 children)

C++ is pretty alright, IMO, but the syntax is kinda clunky though, I think probably because of some historical baggage.

[–] nintendiator@feddit.cl 9 points 6 months ago (1 children)

That and the weird aversion to introducing new or useful keywords, or even extending the symbol set that doesn't even use full ASCII.

[–] lambalicious@lemmy.sdf.org 3 points 6 months ago

Word! The whole snafu with co_routines has been quite the laughable show. It would have been trivially sortable if C++ did something like what PHP did, using a symbol to absolutely disambiguate what is a variable and what is not. That way eg.: await is a keyword, $await is a variable (perhaps a functor).

To make it even better, $ is already unused in C++!

[–] suy@programming.dev 6 points 6 months ago

Correct. Backwards compatibility is both its biggest asset and its bigger problem.

In syntax alone, you can check what Herb Sutter is doing with cppfront. Specifically, the wiki page on the postfix operators is quite enlightening. It shows some interesting examples of how by making everything a postfix operator you drop the need of -> and the duality of pre/post increment and decrement operators.

[–] TropicalDingdong@lemmy.world 9 points 6 months ago
[–] JATtho@sopuli.xyz 7 points 6 months ago* (last edited 6 months ago)

C++: you sure you want to do this? This will either: a) blow your foot off b) be too fast to be measured in micro-benchmarks.

b. B. B. a. then B.

You have chosen to simultaneously blow your arm off and be the fastest code thing on the planet. Congrats. Yes.

[–] Vivendi@lemmy.zip 4 points 6 months ago

Seriously. Try publishing anything not written in Rust nowadays and you WILL get multiple "bUt baut mUh rUsT??? 1?1!! 11!1!" Comments.

[–] ZILtoid1991@lemmy.world 3 points 6 months ago

I'm a D developer, this wouldn't work for me. Hell, I can even in theory directly interact with C++ code from my language of choice, except I still haven't. I have started to write a binding (and some nice D-style API) for Wasmtime, which is written in Rust.

[–] ricdeh@lemmy.world 3 points 6 months ago

Man, I love this template 😍

[–] corroded@lemmy.world 2 points 6 months ago (2 children)

C++ is just as "safe" as Rust if you use modern language features (std::unique_ptr, for instance). I would argue that anyone who says Rust provides better memory safety than C++ most likely is not familiar with modern C++ and still sees the language as "C with classes."

[–] RustyWizard@programming.dev 22 points 6 months ago (1 children)

I would argue that anyone who says C++ provides a similar level of memory safety as rust hasn’t done serious development work in either language.

[–] firelizzard@programming.dev 2 points 6 months ago* (last edited 6 months ago) (2 children)

As someone whose first language was C, I plan to never use C++ for anything more than programming an Arduino precisely because of the multitude of pointer types. A pointer should just be a pointer. Having five hundred different flavors of pointers is confusing as fuck.

[–] Redkey@programming.dev 12 points 6 months ago

That was my first take as well, coming back to C++ in recent years after a long hiatus. But once I really got into it I realized that those pointer types still exist (conceptually) in C, but they're undeclared and mostly unmanaged by the compiler. The little bit of automagic management that does happen is hidden from the programmer.

I feel like most of the complex overhead in modern C++ is actually just explaining in extra detail about what you think is happening. Where a C compiler would make your code work in any way possible, which may or may not be what you intended, a C++ compiler will kick out errors and let you know where you got it wrong. I think it may be a bit like JavaScript vs TypeScript: the issues were always there, we just introduced mechanisms to point them out.

You're also mostly free to use those C-style pointers in C++. It's just generally considered bad practice.

[–] Traister101@lemmy.today 4 points 6 months ago* (last edited 6 months ago)

Smart pointers model ownership. Instead of (maybe) a comment telling you if you have to free/delete a returned pointer this information is encoded into the type itself. But that's not all, this special type even handles the whole deleting part once it goes away.

Since they model ownership you should only use them when ownership should be expressed. Namely something that returns a pointer to a newly allocated thing should be a std::unique_ptr because the Callie has ownership of that memory. If they want to share it (multiple ownership of the object) there's a cheap conversion to std::shared_ptr.

How about a function that takes in an object cause it wants to look at it? Well that doesn't have anything to do with ownership so make it a raw pointer, or better yet a reference to avoid nullability.

What about when you've got a member function that wants to return a pointer to some memory the object owns? You guessed it baby raw pointer (or again reference if it'll never be null).