this post was submitted on 22 Jul 2025
407 points (98.1% liked)

Programmer Humor

25282 readers
652 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
 

I don't think that casting a range of bits as some other arbitrary type "is a bug nobody sees coming".

C++ compilers also warn you that this is likely an issue and will fail to compile if configured to do so. But it will let you do it if you really want to.

That's why I love C++

you are viewing a single comment's thread
view the rest of the comments
[–] BatmanAoD@programming.dev 3 points 4 days ago (1 children)

Borrow checking...existed in C++ too

Wat? That's absolutely not true; even today lifetime-tracking in C++ tools is still basically a research topic.

...someone found memory bugs in Rust, again, because it is NOT soundly memory safe.

It's not clear what you're talking about here. In general, there are two ways that a language promising soundness can be unsound: a bug in the compiler, or a problem in the language definition itself permitting unsound code. (unsafe changes the prerequisites for unsoundness, placing more burden on the user to ensure that certain invariants are upheld; if the code upholds these invariants, but there's still unsoundness, then that falls into the "bug in Rust" category, but unsoundness of incorrect unsafe code is not a bug in Rust.)

Rust has had both types of bugs. Compiler bugs can be (and are) fixed without breaking (correct) user code. Bugs in the language definition are, fortunately, fixable at edition boundaries (or in rare cases by making a small breaking change, as when the behavior of extern "C" changed).

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

Have you heard about cve-rs?

https://github.com/Speykious/cve-rs

Blazingly fast memory failures with no unsafe blocks in pure Rust.

Edit: also I wish whoever designed the syntax for rust to burn in hell for eternity

Edit 2: Before the Cult of Rust™ sends their assassins to take out my family, I am not hating on Rust (except the syntax) and I'm not a C absolutist, I am just telling you to be aware of the limitations of your tools

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

Yeah, and that falls under the first category, bugs in the compiler: https://github.com/rust-lang/rust/issues/25860

(All exploits in that repo are possible due to that bug.)

[–] vivendi@programming.dev -1 points 4 days ago (1 children)

Yeah and those are the ones currently identified (btw that issue isn't completely fixed) because rust never was nor advertised itself as sound. Meaning, you gotta be careful when writing Rust code too. Not as much as C++, but it's not a magical shield against memory problems like people have been shilling it as.

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

I guess what you mean is that Rust doesn't advertise the compiler as being bug-free?

The massive difference here is that C++ has no soundness guarantees even when the compiler is working as intended, whereas Rust actually does in fact give soundness guarantees in the absence of compiler bugs.