Live data from Hacker News

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

news.ycombinator.com

121–130 of 184 posts

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

#121
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 suppose you shouldn't be using pointers if not required, not even smart(er) ones.

They are not free and prevent certain kinds of optimization as well as allow accidentally sharing state.

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

#122
post #42

Do you mind asking 'Why C++'? I know that doesn't answer your question and to be honest, I am curious about the resources which come up here too, but C++ can be so painful to learn that I wanted to know what drives you into that direction. I mean, there are alternatives like Rust. Do you have a specific project in mind, need it to fulfill some résumé requirements or something completely different?

Depending on the direction you want to go in your career, it's still a major need. Any complex or high-performance computing relies on C/C++ pretty heavily still. It's also a good tool to have in your box for building well-performing cross-platform native apps with Qt. I say this as one who's probably at the same stage as OP. Know some C, and reasonably comfortable with the basics. Application of C++ is a little more…

Qt is about the last library I'd call modern in terms of C++ dialect it employs or requires...

(There are worse but deprecated like MFC. Or on par like wxWidgets.)

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

#123

Take a look at how the standard library does things, and particularly anything for which it is not clear to you how one might implement it, or the use of anything whose purpose you don't really understand.

Large parts of the standard library are designed badly. E.g. io streams are horrible, allocators are questionable.

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

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

#124
post #117
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…

Would not recommend Principles and Practice Using C++, it is a fluff loaded book seemingly made to sell to university students.

I think it's a great introduction to Programming, but if you already know some other language, it tends to be verbose - but Stroustrup always tends to be verbose. I, for one, really like his style.

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

#125
I don't see openFrameworks mentioned here: http://openframeworks.cc/

Probably the most comprehensive open-source creative coding framework. Maybe most helpful for familiarity with graphics programming / OpenGL, but it really extends to all types of possible interactions. Maintained by an awesome group of people.

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

#126
post #43

Earlier quoted context omitted.

Not OP, but good question. I find Rust is a much better language, but there are very few mature libraries right now if you do something outside the scope of what Mozilla is doing. Also very few companies that are working in Rust (AFAIK, if you know some let me know) looking for devs. If you want to work in a company that is doing any kind of low level code you will either need C or C++ as a foundation. At least to un…

> if you know some let me know “This Week in Rust” lists explicit job postings. One of the latest companies looking for Rust programmers is a little company you may have heard of: Facebook. That said, many places are hiring good programmers and putting them on Rust projects, rather than hiring Rust programmers explicitly. There aren’t many pure Rust shops yet, so they need a broader skill set.

I'm pretty good in C as well (less C++). I just would like to know beforehand if I could grow into a Rust role there.

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

#127
post #99

I found "C++ Primer" by Lippman et al very well written and comprehensive. It includes C++11 features and every chapter has exercises to make sure you understand the content. https://www.amazon.com/Primer-5th-Stanley-B-Lippman/dp/03217...

Already outdated by 6+ years though.

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

#128

I don't see openFrameworks mentioned here: http://openframeworks.cc/ Probably the most comprehensive open-source creative coding framework. Maybe most helpful for familiarity with graphics programming / OpenGL, but it really extends to all types of possible interactions. Maintained by an awesome group of people.

OpenFrameworks has nothing to do with _modern_ C++. It’s a framework for laymen artists that happens to be written in C++. It won’t teach you about move semantics, lambdas, unique_ptr, for-in loops, etc.

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

#129
post #66
post #43

Earlier quoted context omitted.

Not OP, but good question. I find Rust is a much better language, but there are very few mature libraries right now if you do something outside the scope of what Mozilla is doing. Also very few companies that are working in Rust (AFAIK, if you know some let me know) looking for devs. If you want to work in a company that is doing any kind of low level code you will either need C or C++ as a foundation. At least to un…

Indeed. I still haven't grasped Rust as much as I'd like, but I have to admit that at least it feels like every part of the language fits nicely together with the others, as opposed to the "messy spaghetti" feel I get from C++ (though this is of course my subjective impression). There are things I'd like they do, like removing the Python 2 dependency for building from source, or actually writing a spec. But I guess t…

I never built from source, so Python 2 dependency for that didn't bother me. I kind of like the documentation as spec as long as the language is still evolving so quickly. Maintaining separate documents would be more difficult here.

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

#130
post #42

Do you mind asking 'Why C++'? I know that doesn't answer your question and to be honest, I am curious about the resources which come up here too, but C++ can be so painful to learn that I wanted to know what drives you into that direction. I mean, there are alternatives like Rust. Do you have a specific project in mind, need it to fulfill some résumé requirements or something completely different?

Because you might have to choose between C++ and Go
Post reply on HN