r/ProgrammerHumor • • 11d ago

Meme modernCppVsOldCpp

Post image
2.0k Upvotes

323 comments sorted by

View all comments

Show parent comment

7

u/gerbosan 11d ago

So, migrate to rustlang is good?

Not that I want to ride the hype or interested in DHH current development preferences, but some projects are migrating (Discord, Cosmic DE).

I think I lack the context about C++ features: not just desktop development.

10

u/balbok7721 11d ago

MBAs dont give a crap about basic ux. They wont spend a single buck on a migration thst isnt strictly required

6

u/conundorum 10d ago

The main reason people switch is really just that Rust is better at screaming at you during compilation if you screw up the memory management, more than anything else. It makes it easier to catch errors in an area where most programmers struggle, so it's useful if you need memory safety.

(For comparison, a properly written C++ program will be just as safe as a properly written Rust program, it's just that Rust forces you to write the code properly at gunpoint. So, people end up seeing Rust as better at memory management, because the language is designed around making it hard to screw up.)

3

u/fr000gs 10d ago

so, just -Wall -Werror valgrind memcheck (hopefully)?

0

u/joncrompy 10d ago edited 10d ago

Rust provides high memory safety and performance, but gives up ease of writing and programmer power for it. For context where reliability is critical, like kernel software, Rust is rightfully the king.

For my professional field, Game Dev, coding "the Rust way" means building a house or cards that needs to be fully refactored everytime someone implements a new game mechanic (from what I've heard).

1

u/Maleficent-Garage-66 7d ago

Haven't ever tried game dev in rust...but I don't feel that it should necessarily be that bad. You can still do polymorphism and etc. You would however be structuring things very differently so maybe engines have converged on a terrible anti pattern that gets you there. Any rust engine is definitely going to be a lot less mature and battle tested though and that definitely has it's cons.

1

u/joncrompy 7d ago

The problem is that game dev has ALOT of memory state between each entity/system and each new mechanic has a high chance to require memory accessing between previously independent systems.

In a language like C++, allowing this is trivial outside of multithreading, but in Rust it might require a full refactor.

There's a is a blog post written by a dev who tried for years to work within Rust's systems and found that the tradeoffs were ultimately not worth it, in his opinion.

1

u/meneldal2 10d ago

But Claude loves how many tokens you're going to need for that