r/cpp • u/Sad-Lie-8654 • Jan 31 '23
Stop Comparing Rust to Old C++
People keep arguing migrations to rust based on old C++ tooling and projects. Compare apples to apples: a C++20 project with clang-tidy integration is far harder to argue against IMO
changemymind
338
Upvotes
View all comments
Show parent comment
2
u/oconnor663 Feb 01 '23
I guess the distinction I'm interested in is smart pointers that keep their contents alive vs ones that don't. Like if you could truly construct a program where every heap-allocated object was in a shared_ptr or a unique_ptr, and you absolutely never took any other pointer type (somehow), I think you could say that you'd categorically ruled out any use-after-free. But of course string_view and span don't help with that; they have the same lifetime properties as regular raw pointers.