Live data from Hacker News

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

news.ycombinator.com

81–90 of 184 posts

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

#81
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 a good time to use/not-use certain things. This helped break past that barrier and to improve my skill further.

Also, it helped to write a _lot_ of c++ code and think about how that could be better.

I'm afraid I didn't read a tonne of good C++ code in that period but somehow, I managed to keep growing and at some point, it became my "go to" language and I really started to like it.

Long story, short: Read books from the experts, esp. Dr. Stroustrup.

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

#85
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…

I remember being placed on a C++ project for a few months after having been away from the language for almost 10 years. The lack of raw pointers was an immediate slap in the face and had me going "WTF am I looking at?"

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

#86
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.

From experience I can tell you this: just 'use it' is not enough for some. I have seen truly, truly horrible code written by people who have been using C++ for decades. Let that sink in a bit, then realize that while 'use it' isn't bad advice, it is too general and too limited of a statement :P. You need to learn the right usage as well.

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

#87
Writing a piece of software in C++.

Sizing the softare to fit your schedule: i.e., if you want to be at the level of BJS, write a C++ compiler; if you want to be as good as Google employee, uses the common Google c++ libraries Protobuf ABSL etc. to write a simple webserver with a few APIs. The list goes on and on.

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

#88
post #38

Earlier quoted context omitted.

IMO, Effective C++ is just a collection of warnings about pitfalls, something that is unfortunately needed for C++ programming, so do read it. But it is neither an introduction nor a collection of big picture advice.

I usually recommend Effective C++ as the C++ book that everybody should read second. I'm still not sure what the best book to read first is, though...

Probably Tour of C++ if you're already familiar with older C++. (Or just get the book it's taken from, C++ Programming Language 4th Ed.)

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

#89
post #78
post #54

Earlier quoted context omitted.

You're going to get at least 1 angry Perl programmer explaining that Perl is actually thriving and it's never been better to be a Perl programmer :p Which is actually partially true... the long tail of programming languages today is very, very big. There's probably 10-50x more programmers now than there were back in 1995. The programming world can probably sustain 10-20 mainstream languages these days, if not more.

>>Perl is actually thriving and it's never been better to be a Perl programmer :p Don't know about that. But only yesterday afternoon I spent like 2 hours writing a Perl script to heavy lift some Unix file work, Which I factored would take a week at-least to do in any other language. Perl is still largely a very useful language without any replacements. So are awk and sed. Web development world seems to have moved on…

> But only yesterday afternoon I spent like 2 hours writing a Perl script to heavy lift some Unix file work, which I factored would take a week at-least to do in any other language.

I'm guessing you're more familiar with Perl, because I personally find it hard to believe that Perl by itself is an order of magnitude more efficient to write than Python or Ruby.

Post reply on HN