Hacker News new | ask | show | jobs
by direwolf20 138 days ago
Using containers and std::string for everything eliminates the majority of safety bugs.
4 comments

The safety bar is way way higher.

The C++ WG keeps looking down at C and the old C++ sins, sees their unsafety, and still thinks that's the problem to fix.

Rust looks the same way at modern C++. The std collections and smart pointers already existed before the Rust project has been started. Modern C++ is the safety failure that motivated creation of Rust.

You need `GSL` and `lifetimebound` to approach most modern safety bugs.
If only the standard differentiated between programs that are "mostly" free of UB and programs that aren't.
Not really. We keep getting pointer-like types like std::string_view and std::span that can outlive their referents.