7 ms·
Unsafe Rust is much safer than C
by hermanradtke 2y ago
Unsafe Rust is much safer than C
- bsder 2y ago> Unsafe Rust is much safer than C That is not at all an obvious axiom. I am willing to concede that "Rust" is safer than "C". However, in "unsafe Rust" it is super easy to violate a Rust API precondition that the compiler takes advantage of. Even the Rust intelligentsia have pointed out that writing correct "unsafe Rust" is significantly harder than writing correct C.
- phi-go 2y agoDo you have source on that? I would like to know more. Not disputing this, just curious.
- minetest2048 2y agohttps://chadaustin.me/2024/10/intrusive-linked-list-in-rust/ https://chadaustin.me/2024/10/intrusive-linked-list-in-rust/ HN discussion: https://news.ycombinator.com/item?id=41944121 https://news.ycombinator.com/item?id=41944121 While we at it, someone argued that Zig is nicer than unsafe Rust: https://zackoverflow.dev/writing/unsafe-rust-vs-zig/ https://zackoverflow.dev/writing/unsafe-rust-vs-zig/
- phi-go 2y agoThank you, appreciated!
- vacuity 2y agoTo add on, unsafe Rust's main strength is the tools and the culture of encapsulating it well. It's probably the case that "well designed code that uses unsafe" is much safer overall, as you would expect for a memory-safe language. But it doesn't just come about from using unsafe.