3 ms·
> Logic bugs are far more common AIUI memory safety issues are literally over half of security issues. (Also, Rust's type system makes it much easier to avoid
by lmm 4y ago
> Logic bugs are far more common
AIUI memory safety issues are literally over half of security issues. (Also, Rust's type system makes it much easier to avoid logic bugs).
> C++ isn't inherently unsafe either, you can use it with zero dynamic allocation if you really want or use language tools like ref counted smart pointers.
No you can't. C++ fans always claim this is possible but they're never willing to point at specific rules for which code does or doesn't do this, or which libraries are out there that do or don't follow their rules. It's vaporware.
> Ultimately you can write unsafe and bad rust code too so reviewers will still have to carefully review every submission.
Given that existing review procedures aren't perfect, the acceptable defect rate is clearly not zero. So if switching to Rust eliminates half the bugs, people could do half as much review and the end defect rate would be the same; why would that not be acceptable?
- steveklabnik 4y ago70%, to be a bit more specific than “over half,” yep. That’s roughly the number that keeps coming up across various reports.
- enedil 4y agoA breakdown comparing the language that caused the errors would be helpful. I expect that codebases in C or C++03 or even (idk) C++14 have much higher rate of memory corruption derived vulnerabilities, than those written in C++20.
- steveklabnik 4y agoI agree in the abstract, but people like to argue about if a codebase is truly "Modern C++" or not, even when they use newer versions of C++, due to it largely being about patterns and the amount of them. So you'll have people nitpick this to death.
- pjmlp 4y agoExcept even in C++20 there will the clever dudes writting C strings/arrays, doing strcpy, memset, memcpy,... botching all best efforts for safety. Just go around open source projects from well known ISO C++ members.
- anonymoushn 4y ago> No you can't. C++ fans always claim this is possible but they're never willing to point at specific rules for which code does or doesn't do this, or which libraries are out there that do or don't follow their rules. It's vaporware. I'm no C++ fan, but I've worked on codebases that do zero dynamic allocations including in C++. The rules are something like "never call malloc or use keyword new, communicate with other threads only by copying things into or out of queues." It doesn't save you from buffer overflows or whatever though.