5 ms·
Largest changes (most from C++11, some from C++14 and C++17) are: - std::unique_ptr and std::shared_ptr (your code should not have any new/delete). It's easy t
by MauranKilom 7y ago
Largest changes (most from C++11, some from C++14 and C++17) are:
- std::unique_ptr and std::shared_ptr (your code should not have any new/delete). It's easy to write code with clearly defined ownership semantics, and I've yet to create a memory leak.
- Proper memory model so that multithreading has defined semantics.
- Lots of syntactic sugar (auto, range-for, lambdas, structured bindings, if constexpr, etc.).
- More metaprogramming tools/fun.
C++11 alone is a very different world compared to what you are probably used to.
- noobermin 7y agoGenerally good things, but I get triggered when I hear people call metaprogramming "fun." Such is the beginning of all sorts of woes.
- ncmncm 7y agoMany of the improvements are to make metaprogramming increasingly unnecessary. I practically don't use it at all anymore. But coding on C++ has become quite fun. Generic lambdas deserve much of the credit.
- sramsay 7y ago> - std::unique_ptr and std::shared_ptr (your code should not have any new/delete). It's easy to write code with clearly defined ownership semantics, and I've yet to create a memory leak. I cannot begin to describe how huge a thing this was for me. I came to C++-17 (just about) from C++-98 -- a language I hated so much, I vowed I would never, ever write anything in it on purpose. It is a massively different beast today from what it was, but the biggest thing of all is this change in how you deal with memory. It was like going from a particularly annoying and verbose aberation of C to a particularly fast and expressive version of Python. YMMV, of course. In fact, it may vary to the point of becoming absolutely unrecognizable if you're dealing with a massive legacy codebase. But I have to say, I've become a very big fan in the last few years.
- axilmar 7y agoWhy weren't you using smart pointers before c++11? boost had them, and rolling your own is very easy. I did the latter for a project that started around 2000 and never looked back.
- sramsay 7y agoI think the answer to that is that I wasn't an experienced enough developer at the time to know how to do that. ;)
- noobermin 7y agoIt's strange to even call them the same language, it's even stranger when you consider the same compiler will deal with both subsets of the language. It's at the point where someone tells you something is in C++ and you can't even be sure what that means until you look at their code.
- sramsay 7y agoI keep my head down in language war discussions, but when people start the usual round of complaints and ridicule of C++, this is exactly what I think: I'm not sure we're actually talking about the same language.
- lonelappde 7y agoIt's still terribly verbose. C++17 barely started to get templates under control. Look at how many characters you need to say "if" and "true"
- MauranKilom 7y agoNot sure how to understand your concern. Yes, it's not 05AB1E. Yes, namespaces are necessary if you have code bases with millions of LOC. But for the most part, C++ is as verbose as you make your type and variable names. Do you actually find it verbose to read or also verbose to type? I don't consider the latter an issue since 1. you normally spend much more time thinking than typing while programming, and 2. code is read much more often than it is written.
- umanwizard 7y agoSome more: * Hash maps in the standard library (every so often I have to go and look it up to remind myself that no, I’m not imagining things, C++03 really didn’t have hash maps in the standard library, as ludicrous as that sounds) * Regexes * Option and Variant types * Move semantics And my personal favorite... * foo<bar<quux>> is no longer a syntax error
- lonelappde 7y agoC++ doesn't like making arbitrary choices in standard libraries, and there are lots of performance tradeoffs and API shape choices to make in a language like C++ that refuses to make programers pay for anything they don't want.