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

You missed the point. Just like the author did when he disqualified all the C++ tools

Writing unsafe code and removing tools "because production" gets you unsafe code as shown in that rust cve



With Zig and Rust you have to explicitly opt-out with `ReleaseFast` and `unsafe` respectively, that makes a big difference. Rust has the added safety that you cannot (to my knowledge at least) gain performance by opting out with a flag at compile-time, it has to be done with optimized `unsafe` blocks directly in the code.

Lazy C++ is unsafe, lazy Zig is safe-ish, lazy Rust is safe. Given how lazy most programmers are, I consider that a strong argument against C++.


[dead]


>It has nothing to do with opting out.

It does. The original code compiled because the borrow is computed using `unsafe`. That `unsafe` is the opt-out.

>Zig, Rust and no language saves you when you write incorrect unsafe code. My original point is disqualifying c tools is misleading and everything suffers from incorrect unsafe code

And the other people's point is that if one language defaults to writing unsafe code and the other language requires opting out of safety to write unsafe code, then the second language has merit over the first.


Sure, but unlike C/C++, in Rust my entire codebase is not enclosed in a gigantic unsafe block




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

Search: