Hacker News new | ask | show | jobs
by cglouch 3028 days ago
Does anyone have any recommendations for learning to write modern, idiomatic C++? I used C++ in college for data structures and algorithms, so I have some familiarity with the basics. But we were mostly restricted to using C++98, and I'm not sure what the best practices look like these days with the changes introduced in 11, 14, and 17.
7 comments

Effective Modern C++ by Scott Meyers is a good book that I've been supplementing with google searches. It goes over the main new features in '11 and '14 you would want to know.
+1 for this book. Also, if your company can afford it, having Meyers or Sutter coming on site to give a day or two lecture to a group about Modern C++ is worth it. They both have great handout material, give great lectures/presentations and are very approachable with (even idiotic) questions.

(disclaimer: I am an unattributed - due to company policy - interviewee for Meyers Effective Modern C++)

edit: grammar

Scott retired in 2015; I don't know if Scott is still active in terms of lectures/presentations:

http://www.aristeia.com/

Jon Kalb has told on CppCast that Scott is doing a presentation at CppNow, but totally unrelated to C++ (presentation skills workshop).

http://cppcast.com/2018/03/jon-kalb/

Aw, damn. It's been before 2014 I last saw him in person, so I have no idea. It's a shame, because he is a great presenter with an infectious energy about him that I found really engaging.
I can confirm that this book is a great starting point, having undertaken a similar project last year. Off the top of my head, the biggest change is move semantics, along with smart pointers. Once you have those concepts down the other pieces are comparatively quick to pick up.

I've always liked C++, but I think it's become a much more enjoyable language to use in the last decade.

Oh, while you're at it, check out the Passkey pattern[0], which is a nice way to avoid overuse of friend classes.

[0] https://stackoverflow.com/questions/3324248/how-to-name-this...

It's a good book, but I find his use of his good writing skills to try to smooth over the many terrible parts of the language a little irksome.
I am not an experienced C+++ programmer. That being said, I found Marc Gregoire's book to be pretty good. https://www.amazon.com/Professional-C-Marc-Gregoire/dp/11188...

The 3rd edition covers c++14. New version coming out in April covers C++17.

The super FAQ at by isocpp is very good. https://isocpp.org/faq
I found this a good (if short) primer on the latest features: https://www.amazon.com/11-14-Tips-Understand-novelties/dp/15...