4 ms·
Apart from obviously Rust, there's a subset of C++. One can, of course, do all of the insecure things in C++ that one does in C -- and more, in fact. This is
by amalcon 11y ago
Apart from obviously Rust, there's a subset of C++. One can, of course, do all of the insecure things in C++ that one does in C -- and more, in fact. This is not required, though: you can have bounds-checked "arrays" (vectors accessed with .at(), never operator[]), various types of managed pointer (from boost, or with C++11 the stdlib), and require variable initialization.
One of the big problems with C++ is that few people actually do this. It basically requires putting a linter into your build process, to check for C-isms and unsafe C++ behavior. Otherwise, people will use these things because they are easier.
My favorite thing about Rust is that it's carefully designed to make the safe things easier. It's much better if you need to go out of your way to do something dangerous than the outher way around.
- pjmlp 11y ago> One of the big problems with C++ is that few people actually do this. It basically requires putting a linter into your build process, to check for C-isms and unsafe C++ behavior. Otherwise, people will use these things because they are easier. Which is one reason, why although I like C++, I am happy to only use it in side project, and mostly settle with JVM/.NET stuff for work nowadays. Most of the enterprise code bases I have seen on my career, are mostly C with Classes style and most companies don't use analyzers. I was quite happy when Clang introduction started to change the mentality in regard to analyzers.