Hacker News new | ask | show | jobs
by pnako 2349 days ago
'A tour of C++' by Stroustrup is a good overview of modern C++.

I recently got back into C++ after big hiatus, just like you, and for me the things that changed are:

  - definitely the things you mentioned: much safer constructs (unique_ptr, move semantics)
  - the use of CMake as a build system
  - much less focus on arcane templates and libraries like Boost
  - new tools like sanitizers
  - new IDEs (CLion)
2 comments

Thanks for sharing! I'll be sure to check that book.

Even if CMake is basically a defacto standard, I have a CMake trauma... Do you have experience with things like Scons/Ninja?

For the sanitizers, I had a look at the one from google: https://github.com/google/sanitizers Did you work with any of those, or was it something else?

I definitely have my eyes on CLion, I'll have to convince my University to get a licence as they are already bulk paying for MS Visual Studio (but that one does not work on linux...)

CMake is the defacto standard for a reason. It's a great tool. However, it definitely has a steep learning curve. It took me many hours to get it, because the documentation is, I would not say 'bad' (it's actually really good) but it's really a reference more than a tutorial. So you'll have to hunt for good tutorials on the web, and just like C++ there is an old way to write CMake and a modern way :) I can't recommend a particular tutorial but make sure they talk about 'modern CMake'.

I used SCons a long time ago. It worked but it was extremely slow. Ninja is not designed to be written by hand, it's a back-end to be used by CMake, etc.

Yes, sanitizers are now included in GCC and Clang (it's the same code base, initially developed by Google). Support varies by platform but on Linux/amd64 all of them are available. UBSan, LSan are easy to use and have little impact on performance. ASan and TSan are more expensive but they work well; not unlike Valgrind but still faster. MSan is a pain to configure because all the code must be instrumented (that includes dynamic libraries you use). Not that easy in practice.

All right, thank you for the feedback!
In the end, I went for

- Principles and Practice Using C++ by Stroustrup, covering C++11:14

- C++17 - The Complete Guide by Nicolai M. Josuttis

- using CLion