Hacker News new | ask | show | jobs
by jcranmer 263 days ago
> As far as I can tell, modern C++20/23 is as safe (if not safer) than rust.

It is not. Rust will, for example, prevent the following memory-safety issue from compiling:

    std::vector<T> meow;
    T &x = meow[i];
    meow.push_back(...); // Oops, x is now dangling, maybe!
    x.a = ...;
(This sort of pattern is responsible for nearly 100% of the C++ memory safety issues I know I've committed in the past several years.)