by zerr · 4y ago · 0 comments
Note that you might choose to forbid anything that doesn't count as "modern C++", e.g. by enforced linting. Equivalently, you could instead have your compiler reject such programs (perhaps deciding to rip out various features and modules from the compiler, to avoid them being used). Either way, you're no longer writing C++: you're writing some other language (say, "C+++"), which is a sub-set of C++. In which case, you've done what the author suggested: deprecating C/C++ in favour of something safer!
So, you would mandate using Rust without "unsafe", then? Good luck with that.
C++ changed a lot over time, and the way modern code is supposed to be written is very distinct from "C with classes", but you still can do that if you want.
Many experts disagree with the way modern C++ evolves.
To say that modern code is supposed to use all the C++11-forward features or else it's obsolete is a massive bias on your part.
All that said, some parts of moder c++ like move semantics do really cut down on defects. People who go out of their way to use *all* of the new toys create codebases that make my teeth itch.
https://gist.github.com/caiorss/c7db87df674326793431a14006aa...
It looks pretty much nothing like a C program doing the same job.
A lot of those features were made to make C++ a safer language to use. Eg, with a construction like:
for(const auto& it : ast){
You can't accidentally walk past the end of the array by going one item too far. But C++ still allows you to write code the way you'd do it in C.Bold claim.
The sentence is indeed from a meme template[1], but I thought that my comment would stand on its own.