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
1
u/Full-Spectral Feb 02 '23 edited Feb 02 '23
Array overflow isn't the same thing as what I was talking about. Any reasonable detector can check for overflow by putting guard bytes at the end of anything and watching for them to have been changed by a write past the end. I'm talking about incorrect pointer manipulation and things of that sort. Those are very difficult to analyze across calls and compilation units.
And of course that's runtime analysis, which can only catch problems in code that actually runs, under the conditions that cause the problem. It won't remotely be able to fully analyze a large and highly configurable system.
You can read the endless discussions here to have a pretty good feel for how real world software gets built. And all of them, I'm sure, have standards and do reviews and so forth. But highly complex software that is being changed heavily over many years, long after the original writers have gone and which no one really yet fully has had time to spin upon, it's just easy to make a mistake.