Live data from Hacker News

Ask HN: Best way to learn modern C++?

news.ycombinator.com

91–100 of 184 posts

Re: Ask HN: Best way to learn modern C++?

#92
post #58
post #18

Use it. Not being a smart@$$ here. Any language you want to learn will only become natural when you've used it for a significant project or set of exercises. Either clone or port something non trivial, or use it for your latest pet project, or get permission to use it at work.

That's a pretty useless answer. It's easy to use C++, but in a non-idiomatic or C-style way. I think the OP is aware of this problem and is looking for concrete examples of modern C++.

I think reading best practices and most other forms of technical training work best after some experience is gained, even poor experience doing it the wrong way.

It's similar to why university lectures work best if the audience has already done its assigned reading. The people in the audience have better questions in mind while listening, so they can better intuit when a gap is filled in or if some part of the explanation doesn't make sense.

Re: Ask HN: Best way to learn modern C++?

#93
post #77

One of the trickier things about C++ for me (in terms of “getting lost”) when I first started was that there’s no standard C++ project structure. It varies based on the build system you use, whether what you’re building is just an API or something else, and personal preference. I recommend looking at some open source C++ projects like Tensorflow (Google), LevelDB (also Google), folly (Facebook), MongoDB, and Thrill (…

100% agree - the code quality in some of these projects (e.g. folly) is outstanding.

Re: Ask HN: Best way to learn modern C++?

#94
post #17

- Tour of C++ ( http://www.stroustrup.com/Tour.html ) - Principles and Practice Using C++ ( http://www.stroustrup.com/programming.html ) - From Mathematics to Generic Programming ( http://www.fm2gp.com/ ) - The Scott Meyers books Some of the Bjarne Stroustrup videos, "Learning and Teaching Modern C++" - https://www.youtube.com/watch?v=fX2W3nNjJIo Some of the Herb Sutter videos, "Writing Good C++14... By Default" - ht…

I agree with this completely :) I would also like to add that it helps to read "The Design and Evolution of C++". I found that I plateaued early in my C++ journey. However, I was always reading from the experts and it really helped to read material from Dr. Stroustrup. Once I began to see the common thread behind what he was saying and understood why some things were the way they were, it helped understand when it's…

> I would also like to add that it helps to read "The Design and Evolution of C++".

I think that book is worth reading even to people who have no intention of going anywhere near C++, as long as they are interested in programming language design and evolution. I wish there were more books like this one to explain the kind of thinking that went into the design of a language and to tell its history.

Re: Ask HN: Best way to learn modern C++?

#95
post #15

Google's C++ course at https://developers.google.com/edu/c++/ looks useful to start with.

Don’t forget SFINAE. It’s what most of the modern type traits rely on and something you’d have to understand, at least conceptually, to fully understand how to effectively use things like std::enable_if.

For those unfamiliar with C++, SFINAE is "Substitution Failure Is Not An Error". The short of it is how the language deals with overload selection with templates. If you want a more detailed explanation and example, see [1].

[1] https://en.wikipedia.org/wiki/Substitution_failure_is_not_an...

Re: Ask HN: Best way to learn modern C++?

#97
post #41

If you want fun miniproject may I suggest Peter Shirley's excellent mini-raytracing bookseries: Ray Tracing In One Weekend, Ray tracing the next week, and Ray Tracing, the Rest of Your Life: https://www.amazon.com/Ray-Tracing-Weekend-Minibooks-Book-eb... If you get interested on rendering Matt Pharr & Co's Oscar winning "Physically based rendering" is a didactic masterpiece. https://www.amazon.com/Physically-Based-Re…

Indeed this is a good project. And a great set of books. I second this!!!!

Re: Ask HN: Best way to learn modern C++?

#100
post #25

IMO, the classic C++ book/author is still the best: Effective C++. Don't forget about the sequels, including the mostly overlooked Effective STL (which I happen to like better than the first two books). And to address the modern part of this question, I'll add that Scott Meyers has written Effective Modern C++ as well, but I'd read that last after getting the hang of C++03. No matter what people say, I tend to believ…

As someone who programmed in "classic C++" for decades, I feel like modern C++ is pretty different, and that it's not just syntactic sugar to make some ugly things easier. The biggest example is that my natural inclination to use raw pointers everywhere and manage all memory myself, while idiomatic modern C++ is full of unique_ptrs and shared_ptrs everywhere, and raw pointers seem to be regarded as a code smell. Conv…

OK from that perspective I can relate. Even before using C++11 I was using a lot of the new STL through Boost. If you use Boost, the only fundamental differences are syntax like auto, variadic macros, constexpr, noexcept, and lambdas all of which are familiar enough to get by. The only practical differences that have no equivalent in C++03 is move operations and maybe the threading/chrono stuff. Effective Modern C++ covers that so that's all I needed to "upgrade."
Post reply on HN