Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Overall it does indeed seem to be the case for roughly 25% of Rust crates:

https://rustfoundation.org/media/unsafe-rust-in-the-wild-not...

https://thenewstack.io/unsafe-rust-in-the-wild/

https://github.com/sslab-gatech/Rudra/blob/master/rudra-sosp...

https://internals.rust-lang.org/t/canvas-unsafe-code-in-the-...

Again, not a criticism of the language itself per se, and certainly not trying to imply that all Rust programmers go around writing unsafe code all day long. It's just kind of funny to me that it is touted as being so much more safe than C++ when the reality is that at least some of those features are in fact disabled for one reason or another in real-world programs.



> Most of these Unsafe Rust uses are calls into existing third-party non-Rust language code or libraries

This is very different than

> in the name of speed, efficiency, etc

And also does not demonstrate that

> the end result being a program which isn't much more secure than its C++ equivalent.

At all.


What are you trying to say? C++ can be just as safe as Rust. The latter is just easier to use, especially in terms of working as a team of developers insomuch as the safety-nets are by default in place. Once again, C++ is powerful but comes with just as many footguns as C (in fact, more) and so requires a bit more finesse, experience, and skill to work with safely. Otherwise it can encapsulate pretty much any functionality you could possibly imagine, and that includes safety features. Checked memory accesses, managed memory, well-behaved arithmetic, all of that and more can be codified as a set of objects and interfaces. I started out in assembler, worked up to C, then finally on to C++ where I actually found it quite easy to write safe programs by just sticking to a strict set of guidelines. And that works. I have code that has been running almost continuously for over a decade without a hitch, and I credit that to good programming practices.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: