I actually think modern C++ is less safe than C, because of the ability of destructors to be invoked invisibly and cause use-after-free, just to name one major issue.
Re:Death to C, ++
by jstewartmobile on Sunday July 16, 2017 @01:46PM
(#14783198)
That's not even the half of it! Start using a variety of different C++ compilers. Then there would probably be more profit running bets on what the code is going to do than there would be in the actual software.
Re:Death to C, ++
by elementalest on Monday July 17, 2017 @01:19AM
(#14785862)
Unless I'm mistaken, if you're using smart pointers, the memory wont be freed until the destructor has executed its code. Use after free should only be an issue if you're using raw pointers.
> Use after free should only be an issue if you're using raw pointers.
Which you are, because "this" is a raw pointer. The same applies to references and iterators, which are used everywhere. It's not feasible to use C++ without using those features.
Besides, you can get UAF without any references at all. Read/write races on a vector, for example.
Re:Death to C, ++
by bobbyi_settv on Sunday July 16, 2017 @01:52PM
(#14783230)
The reason to use C++ is that it's reasonably widely known. "Modern C++" isn't.
I went to college less than 20 years ago where I used plenty of C++ and I've had multiple jobs since then using it (my current work is in Scala). I have no idea how to work in Modern C++ and I'm pretty confident it would take longer for me to learn than Rust.
I do think Rust is a viable replacement for C, but not a replacement for modern C++, rather an alternative - at least for the foreseeable future.