3 ms·
I keep reading how C++20/17/14/11 is entirely different. I've been programming in C++ since 2004, involved in Boost then the standards committee. For me there
by mgaunard 4y ago
I keep reading how C++20/17/14/11 is entirely different.
I've been programming in C++ since 2004, involved in Boost then the standards committee. For me there hasn't really been such a big change, it's always the same language at core, with a few evolutions, that mostly make it slightly more terse.
- spacechild1 4y agoIMO move semantics, auto, lambdas and smart pointers have changed the way we write C++ dramatically. I work on both old and modern C++ codebases and the difference is like night and day...
- mgaunard 4y agoSmart pointers are not a language feature, and are generally a bad practice (shared ownership is a bad idea to begin with). Lambdas, just syntactic sugar for function objects. auto, you could just spell out the type and provide a mechanism to deduce it (e.g. the old result_of protocol). Move semantics, this is simply distinguishing lvalues from rvalues in overload resolution. There were other ways to do that before albeit not as accessible to the layman.
- spacechild1 4y agoI generally disagree with your assessment, but the following needs to be called out in particular: > Smart pointers are not a language feature, and are generally a bad practice (shared ownership is a bad idea to begin with). Smart pointers don't imply shared ownership, see std::unique_ptr. Or is std::unique_ptr considered bad practice as well? That would certainly be news to me ;-)
- TillE 4y agostd::unique_ptr is of course the opposite of shared ownership, in that it requires you to explicitly transfer ownership if you need to do that. It's a beautiful feature which improves code clarity and reduces bugs.
- spacechild1 4y agoYes! Also, it significantly reduces the need for user defined destructors and move constructors/assignment operators.
- deleted 4y ago[deleted]
- jahnu 4y agoI think I'd just give up and become a baker or something if I had to go back to pre c++11.