Hacker News new | ask | show | jobs
by witheld 1250 days ago
Sure Bjarne, you’re right, if you follow best practices- use static analyzer- special compiler time options. If we research and develop, we can make a safe C++.

But if you wanna write safe code, from scratch, because you don’t want to recycle your dangerous old C++ codebase; then why would you write that new code in C++ when rust is ready and here to do it?

1 comments

Ok but the static analysis tools that are equivalent to what Rust does involve bolting a borrow checker on to C++ at which point you might question what you are trying to achieve because you can't reuse any of the existing C++ code in this configuration as all the other C++ developers failed to use your specific static code analysis setup.
And also, unlike Rust, C++ was not designed to support the borrow checker, so any code that you’re writing might not even be analysable properly by the C++ borrow checker
See here for the current status in VC++ as of last December. Plenty of work still to do.

https://devblogs.microsoft.com/cppblog/high-confidence-lifet...

Sure. As was obvious from the beginning for anyone who's tried to do lifetime analysis on mostly-unannotated C++, this is going to become another "bug reporting" tool that doesn't accomplish anything close to what Rust does. Most likely, all it will do is catch a few of the more obvious bugs so they pass various tutorial examples people use to show why you need borrow checking, leading C++ programmers will believe the problem is solved when it isn't.