Ask HN: Best way to learn modern C++?
171–180 of 184 posts
Re: Ask HN: Best way to learn modern C++?
#172Earlier quoted context omitted.
> Large parts of the standard library are designed badly. That's true, but IMO it's useful to study the standard library to understand what it offers , as opposed to examples of well-designed C++ code.
People who spent many years developing C++ already understand what the standard library offers, regardless on whether they studied that deliberately. People coming to the language lack the expertise to tell well-designed code from bad-designed. It’s tempting to treat the whole standard library as an example of the former. Maybe that’s a personal thing but I remember doing that when I just started my career back in 20…
That statement isn't true for (at least) me. The main reason is that I'm usually working on code that must be compile-able as C++11, and/or may require an old-ish version of gcc's standard C++ library.
So in my daily work I usually have little/no reason to interact with the newer parts of the standard library.
Re: Ask HN: Best way to learn modern C++?
#173Earlier quoted context omitted.
Agreed on D&E, but I think it really does need an update now.
I would love a book similar to C# In Depth but for C++. The book takes you on an evolutionary tour of C#s features, version-by-version. One of my favorite programming books of all time and a good read even for someone who doesn't program in C#.
Re: Ask HN: Best way to learn modern C++?
#174Use 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++.
Re: Ask HN: Best way to learn modern C++?
#175Use 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++?
#176IMO, 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…
It's a pity that one of the most recommended books is about the pitfalls of C++ and is by someone on his own admission has never written production C++ code. Of course it's a very good book though. My recommendation is for "Accelerated C++" by Koenig and Moo. It's rooted in actual teaching experience and compared to most C++ books is pretty slim. The only negatives these days is that it is a bit old and (still) expen…
Re: Ask HN: Best way to learn modern C++?
#177Earlier quoted context omitted.
I share your concern. Even if one isn't (knowingly) dealing with older C++ code, all of the language rules apply to every line of C++ being compiled. Just one typo, or misguided use of syntax, and a person might be using some "older" revision of the language without knowing it. And I'm not aware of any tool that will warn the programmer that he/she has done that. So I'm concerned that programmers schooled only in "mo…
>"I'm curious if people have found this to be a problem in practice." Same. And I think you articulated the specific concerns I have about just learning the "modern" version. It would certainly lower the barrier to entry in learning C++ if this was an unfounded concern. C++ has some 35 year of history and changes at this point. This point alone adds(for me anyway) to the perceived cognitive load of learning it. C als…
If the Javascript community, which is as fragmented as C++, if not more, could introduce "strict" mode and enforce it basically everywhere, then maybe C++ could do the same thing.
Have C++20 recommend a certain subset of C++, have C++24 warn as deprecated features not in this subset, have C++30 error out on everything outside this subset, unless the compiler is set to compatibility mode and finally have C++40 refuse to compile the old code.
Re: Ask HN: Best way to learn modern C++?
#178Earlier quoted context omitted.
>"I'm curious if people have found this to be a problem in practice." Same. And I think you articulated the specific concerns I have about just learning the "modern" version. It would certainly lower the barrier to entry in learning C++ if this was an unfounded concern. C++ has some 35 year of history and changes at this point. This point alone adds(for me anyway) to the perceived cognitive load of learning it. C als…
> It would certainly lower the barrier to entry in learning C++ if this was an unfounded concern. If the Javascript community, which is as fragmented as C++, if not more, could introduce "strict" mode and enforce it basically everywhere, then maybe C++ could do the same thing. Have C++20 recommend a certain subset of C++, have C++24 warn as deprecated features not in this subset, have C++30 error out on everything ou…
Alternatively, one could take a page from CMake's playbook with "policies" [0].
[0] https://cmake.org/cmake/help/v3.7/manual/cmake-policies.7.ht...
Re: Ask HN: Best way to learn modern C++?
#179Earlier quoted context omitted.
> It would certainly lower the barrier to entry in learning C++ if this was an unfounded concern. If the Javascript community, which is as fragmented as C++, if not more, could introduce "strict" mode and enforce it basically everywhere, then maybe C++ could do the same thing. Have C++20 recommend a certain subset of C++, have C++24 warn as deprecated features not in this subset, have C++30 error out on everything ou…
I'll take your word for it regarding JS, but I was thinking along the same lines w.r.t. C++ deprecation. Alternatively, one could take a page from CMake's playbook with "policies" [0]. [0] https://cmake.org/cmake/help/v3.7/manual/cmake-policies.7.ht...
I think C++ is getting modules, maybe they could do the same thing?
Re: Ask HN: Best way to learn modern C++?
#180I'm at CU Boulder and their curriculum is outdated (90s) and backwards. What resources could I point the professors towards?