r/ProgrammerHumor • • Oct 17 '26

instanceof Trend thatsAFunnyThingThatHappenedOnce

Post image
4.6k Upvotes

524 comments sorted by

View all comments

174

u/feldomatic Oct 17 '26

tbf, C++ allows memory safety, while Rust requires it

29

u/Civil-Appeal5219 Oct 18 '26

Wait lol I think he’s talking about AI, no?

0

u/chairzaird Oct 18 '26

This is what I assumed also

3

u/maser120 Oct 18 '26

True and it's totally reasonable now to adapt Rust (an not C++) as a language for kermel development but afaik Linus' rant on C++ goes way back in time (when Rust wasn't a known, popular and well-developed language).

-11

u/reallokiscarlet Oct 17 '26

One can be coded by hand, the other if coded by hand can be considered artisanal.

-25

u/jdefr Oct 17 '26

Unless you wrap things in unsafe{} which is very easy to do in order to side step this “hard requirement”

22

u/qichael Oct 17 '26

Yeah, and then your reviewer asks why you’re using unsafe whereas in C++ everything is unsafe by default

5

u/BeforeDawn Oct 18 '26

That's a pretty weak equivalence.

Rust enforces memory safety by default, and unsafe{} requires an explicit opt-out for specific operations the compiler cannot verify. Even then, it doesn't disable the borrow checker or the rest of Rust's safety checks.

More importantly, you can configure a Rust project with unsafe_code = "forbid", making any attempt to introduce unsafe code a compilation error.

So we're comparing a language where memory safety is enforced by default, exceptions are explicit and auditable, and unsafe code can be prohibited outright, with one where potentially memory-unsafe operations are permitted in ordinary code by default.

Being able to deliberately opt out of certain safety guarantees doesn't make it remotely equivalent to C++. Having an escape hatch isn't the same as having no guardrails in the first place.

1

u/rexpup Oct 18 '26

You understand that restricts the risk area, right? It lets you reason about the tricky things over 10 lines rather than 1000 lines

-8

u/daviddisco Oct 17 '26

why would people down vote this? It is absolutely true.

2

u/BeforeDawn Oct 18 '26

If you're not asking rhetorically, this is the reason.

1

u/100BottlesOfMilk Oct 18 '26

Because, while the language allows you to write unsafely, it doesn't allow you to unintentionally do so unlike C++. And it's simple to prevent anyone from writing code that isn't memory safe by just not allowing it full stop