Ask HN: What's the best way to start with C++?

3 points by paloaltokid ↗ HN
Hey HN, I've been programming for about 10 years now and I decided that it's finally time. I've always wanted to learn C and C++ but never got around to it.

I've worked in Java, C#, Ruby, Python, JavaScript, the usual suspects on the web. So I'm happy to invest time in learning a language.

My main question is two-fold: * what are the best resources (books, tutorials) out there? * if you are currently working in C++, what do I absolutely have to know that might not be obvious?

Thanks so much!

4 comments

[ 0.25 ms ] story [ 15.4 ms ] thread
1) There are so many resources. Your best bet is to find 10 or so that teach modern c++ (c++11 & c++14), and follow through with your favourite.

2) Memory management is the biggest difference from Java and C#. Try not to use pointers unless you have to, when you do try to anchor the pointers in stack data (created without new), if you have to use new try to wrap the pointers in RAII classes (smart pointers).

3) C++ is multiparadigm, don't feel required to stick religiously to OOP practices. functional and procedural techniques can be better if you know what you're doing.

4) The stl isn't as... robust as the standard libraries of other languages. You WILL need to search for third party libaries.

The STL is not that bad, cppreference (http://en.cppreference.com/w/) can be really helpful. Otherwise you can take a look at Boost (http://www.boost.org) if the STL is not enough for what you want to do.

And for the language itself, cprogramming (http://www.cprogramming.com) is a really good aid for the latest concepts like auto and decltype

I love the stl, it's almost always the best thing to use in C++ (wrt Cost/Benefit, love me some vectors). My comment was geared to someone who does "Java, C#, Ruby, Python, [and] JavaScript" programming. The most notable omissions in the c++ stl is GUI stuff, which comes standard in C# and Java.

As an aside, TDD and refactoring also aren't as mature in C++ (vs Java, C# and Javascript).

Some good C++98 books :

- Accelerated C++: Practical Programming. A good quick tour of C++98

- Effective C++, More Effective C++,Exceptional C++, C++ Coding Standard

Many patterns to follow or be aware of. More generally, any book by Herb Sutter.

Good recent books (msut have !!):

- Effective Modern C++ (same as previous, but more focused on C++11 and 14)

- Programming: Principles and Practice Using C++ (A general introduction book by Stroustrup on programming using C++)

- C++ Primer (The spiriual son of Accelerated C++, the best introduction book about C++ I know)

The textbook and more specific books :

- The C++ Programming Language (the ultimate C++ textbook)

- C++ Template the complete Guide (focused on templates)

- C++ Concurrency in Action (focused on threading)

In a second time, have also a look at some libraries like boost (many specific purpose components), Qt (huge framework for making GUI), Poco.

- Website https://isocpp.org/ (the official website for the language).

- Have a look at usenet (comp.lang.c++ and comp.lang.c++.moderated), CppCon's videos, Meeting C++ videos and Channel 9