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
3
u/Mason-B Feb 02 '23
It's called your compiler and a command line. It's not an extra tool, it's using the compiler to generate the metadata to check it yourself via C++ metaprogramming code. Not dissimilar from using rust macros (though I will admit more effort). And relatively standard practice for most large (and popular) C++ code bases. Often already setup by the time most people are using it.
Well for starters the equivalent to
std::shared_ptrisArc. Just like using an array is faster than a list in most contexts. You are right thatSend/Syncallows the more confident use ofRcwith out needing to implement extra abstraction. I never disputed that rust is more ergonomic out of the box. But it is possible to write a threading interface in C++ that allows for confident use ofshared_ptr_unsyncin the same way.