I really wish there would be a linter (I realise it's probably a nearly impossible task) which would complain when you use legacy, unsafe language features.<p>As someone who doesn't work in C++ or have the benefit of 10 years experience to see the flaws, trying to write modern, safe C++ is essentially impossible. I spent a solid week trying to write something safe and only use C++14/17 features when they were available, and encountered a mountain of outdated- and mis-information about what one can and can't do, what is and isn't considered safe and why one certain feature is better than another.<p>It's nobody's fault that this happens, but with C++14 apparently fast becoming a language that is addressing it's #1 pitfall (safety) in an apparently very adequate way, it's frustrating that there's no "safe code" linter to stop rookies stepping on landmines.<p>Thanks for the list, it's a solid start, and the sibling comment about C++ Core Guidelines is another solid resource.
Yeah more features is exactly what C++ needed...<p>Am I the only one who uses C++ as C with classes? Sometimes I use vectors or strings and I like default values in functions and other minor improvements to C. I don't want to reimplement the n'th version of string concatenation when I can just use the "+" operator, sure... and there starts the rabbit hole. Before you know it you have a "protected abstract virtual base pure virtual private destructor" and have to explain the new hired mathematician who only has experience in R what the fuck you are doing.
This made me think of the passage below from Edsger Dijkstra's ACM Turing Lecture from 1972. Back then there was no C++.<p>"I remember from a symposium on higher level programming language a lecture given in defense of PL/1 by a man who described himself as one of its devoted users. But within a one-hour lecture in praise of PL/1. he managed to ask for the addition of about fifty new “features”, little supposing that the main source of his problems could very well be that it contained already far too many “features”. The speaker displayed all the depressing symptoms of addiction, reduced as he was to the state of mental stagnation in which he could only ask for more, more, more..."<p><a href="https://www.cs.utexas.edu/~EWD/transcriptions/EWD03xx/EWD340.html" rel="nofollow">https://www.cs.utexas.edu/~EWD/transcriptions/EWD03xx/EWD340...</a>
Good supplementary material to the C++ Core Guidelines.[1] If you haven't checked it out yet, both VS 2015 and clang offer checkers[2]<p>[1] <a href="https://github.com/isocpp/CppCoreGuidelines" rel="nofollow">https://github.com/isocpp/CppCoreGuidelines</a><p>[2] <a href="https://reviews.llvm.org/diffusion/L/browse/clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/" rel="nofollow">https://reviews.llvm.org/diffusion/L/browse/clang-tools-extr...</a>
C++11 and C++14 made me start to like C++. The build workflow is still horrible and cumbersome but at least the language itself has become nice to use.
The one feature that really annoys me is the std::optional. This is awesome and very needed feature however it is too clunky for something that should be used very frequently. Swift does such a nice job with its '?' operator, I wish C++ had something similar.
I really wish a group of really smart dev get together and come up with a new language based just on the modern C++. Perhaps even call it MC++ (Modern C++). Make it's syntax as simple and easy to learn as Python and yet give us the performance close to the compiled C++.
I'd take that knowing very well that I can't do all the powerful stuff I could with C, yet I have a safe and idiot-proof language to work with in my hands.
Nice summary! As someone who writes multi-platform C++, it would would be even greater (but a lot more work) if each feature listed which version of each major compiler introduced support. (ie. Can I use this feature if my codebase is currently compiling under given versions of Clang, GCC, VS.)
Most features are very good. My favorite ones are range-based loops, lambdas, and strongly-typed enums.<p>The things I dislike most are pairs and tuples. They make the code enormously harder to read, understand and debug, compared to non-standard classes or structures with meaningful member names. Even this guide promotes them in “using Coordinate = std::pair<int, int>;” Please, never do that, create your own class with x/y or latitude/longitude instead.
It is worth to note that template-related features make compilation time significantly longer. It might seem no-problem unless you face it in a bigger team, then these extra seconds (or minutes) are multiplied.