4 ms·
So I'd like to learn more about modern C++ and how to write it, but I'm not really sure where to begin. I've tried a couple of times, but coming from a C backgr
by doldge 9y ago
So I'd like to learn more about modern C++ and how to write it, but I'm not really sure where to begin. I've tried a couple of times, but coming from a C background, my code tends towards C styling with only the occasional use of C++ features.
Is anyone aware of a good tutorial or reference list for writing good modern C++ (C++11 or newer, I guess)?
- lorenzhs 9y agoI really enjoyed "Efficient Modern C++". I'd describe it as a good overview of new features in C++11 and 14, how to use them, and how they fit together, but I'm not sure whether it makes for a good "C++ for C programmers" book.
- deleted 9y ago[deleted]
- pveierland 9y agoThe following is a readable and modern FAQ which describes most language features: https://isocpp.org/faq https://isocpp.org/faq My preferred reference for the language and standard library: http://en.cppreference.com/w/ http://en.cppreference.com/w/ The following is a longer guide on modern C++ style: https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md https://github.com/isocpp/CppCoreGuidelines/blob/master/CppC...
- Veratyr 9y agoAs a newcomer to C++ myself, I found Stanley Lippman's C++ primer to be helpful. The latest edition includes the newer features. And in case it helps, the main things I find myself using differently to C are: - Smart pointers. If you're not using them, use them. They're amazing. Seriously. Never have to worry about freeing something ever again. - Object oriented design. - Const reference arguments. - The occasional auto.
- twoodfin 9y agoI'd add RAII to this list. Also, I find simple template functions to work as an incredibly powerful macro system.
- ChrisSD 9y agoI'd second C++ Primer. It's a great overview of the language and has been updated for C++11. Unfortunately it was written too early for C++14 and beyond so if there is a newer edition planned (I've no idea) it might be worth the waiting. In any case C++11 was the big change for C++ so the fifth edition is still worth while. One word of warning though, there's a confusing similarly titled book called "C++ Primer Plus" which you should avoid at all costs.
- aurelian15 9y agoI really enjoyed "A Tour of C++" by Bjarne Stroustrup, which is a short book giving an overview of C++ features. It sticks to modern C++ practices from the very beginning. Unfortunately, the book is C++11 only and correspondingly does not talk about C++14 or C++17.
- jaiprabhu 9y agoCheck out this recent post by Simon Brand on this subject - https://blog.tartanllama.xyz/learning-cpp/ https://blog.tartanllama.xyz/learning-cpp/