Learning C++ The Right Way

Started by
11 comments, last by daviangel 14 years, 5 months ago
I decided today that I want to (re)learn C++. I'd consider myself pretty much a novice with C++ at this point. I know enough to get some things running, I have a decent grasp of pointers/references (though I still could use a little more work on them), and I get the general syntax. But there's still so much I don't know or don't know fully (like the variations of 'const', for example). I know quite a bit of C# and .NET and now that I have a solid grasp on most of what it takes just to program various things, I decided it's time to get to know C++ so I can continue learning native DirectX without being hindered by unfamiliarity with the language. So my question is where to go to learn C++ the right way? Any books or websites that stand out as great resources for learning C++ without any (or much) misinformation? I've searched around and found things, but I wanted to find out from people who already know C++ where the good references really are. Thanks much.
Advertisement
While I normally don't recommend them, the Effective C++/STL books are actually pretty good about condensing the unwritten C++ foibles into text. That info more than anything is what an experienced programmer needs when moving into C++. The C++ Standard Library by Josuttis is something I always recommend.
The standard list of books to read are:

# "Accelerated C++" Andrew Koenig and Barabara Moo
# "The C++ Standard Library" Nicolai Josuttis
# "Effective C++" Scott Meyers
# "More Effective C++" Scott Meyers
# "Effective STL" Scott Meyers
# "Exceptional C++" Herb Sutter
# "More Exceptional C++" Herb Sutter

The first, Accelerated C++, will cover all the fundamentals.

The second is an in-depth study of how to use the standard library. Read as much as possible until your brain goes numb, then crack it open every few months and read a chapter. It is an excellent reference.

The Effective and Exceptional series both cover important information, presenting it in bite-size items that are easy to digest.
For the meat without the fat, http://www.parashift.com/c++-faq-lite/
As a follow up, http://yosefk.com/c++fqa/
Quote:Original post by NickGravelyn
I decided today that I want to (re)learn C++. I'd consider myself pretty much a novice with C++ at this point. I know enough to get some things running, I have a decent grasp of pointers/references (though I still could use a little more work on them), and I get the general syntax. But there's still so much I don't know or don't know fully (like the variations of 'const', for example).

I know quite a bit of C# and .NET and now that I have a solid grasp on most of what it takes just to program various things, I decided it's time to get to know C++ so I can continue learning native DirectX without being hindered by unfamiliarity with the language.

So my question is where to go to learn C++ the right way? Any books or websites that stand out as great resources for learning C++ without any (or much) misinformation? I've searched around and found things, but I wanted to find out from people who already know C++ where the good references really are.

Thanks much.
This might seem like kind of a glib answer, but I've found this site to be a good reference for those interested in learning modern and idiomatic C++. As for other references, there are some books that seem to be mentioned often, although I can't call them to mind at the moment [Edit: see above]. I would however strongly recommend the C++ FAQ Lite; reading through it would definitely be a good place to start (and you'll most likely find yourself returning to it often).

As you probably already know, people use the C++ language in a lot of different ways; in particular, a lot of developers eschew its more modern features and approach it more as 'C with classes'. Sometimes this is done for good reasons (e.g. when developing for platforms with limited resources or poor compiler support), sometimes for bad reasons (e.g. 'my cousin's friend read online that the STL is 'teh slow' and should never be used'). If you're interested in improving your C++ skills though, my advice would be to familiarize yourself with modern idioms, libraries, and techniques (Boost/tr1, smart pointers, delegates, lambda expressions, RAII, etc.), and use them (or not) where and when you see fit.
Thanks for all the pointers. I guess a trip to the library will be in order. :)
Thank god, here's someone who wants to learn how to write proper C++! C++ is an extremely complex language -- after years of working with it it still surprises me more often than I'd like to admit. :)

The C++ FAQ Lite, which someone mentioned, is a very good resource if you're trying to go beyond the basics of C++. It goes over some common misconceptions and best practices when using the language, and also explains its fundamental concepts. If you are serious about learning C++, I suggest you read it and practice until you feel that you are comfortable with all the aspects of the language that the FAQ covers. In particular, you need to have a strong understanding of pointers (and memory management), references, exceptions, virtual functions, const correctness and RAII to write correct, reliable software in C++. There are certain things in this FAQ that you may want to steer clear of because they are considered flawed or deprecated. For example, in certain places it encourages the use of exception specifications (flawed, often not well supported in modern compilers) and the std::auto_ptr class (use boost::scoped_ptr instead).

Quote:Original post by jyk:
[...] in particular, a lot of developers eschew its more modern features and approach it more as 'C with classes'.


Incidentally, "C With Classes" was the original name of C++. :)
Quote:Original post by frob
The standard list of books to read are:

# "Accelerated C++" Andrew Koenig and Barabara Moo
# "The C++ Standard Library" Nicolai Josuttis
# "Effective C++" Scott Meyers
# "More Effective C++" Scott Meyers
# "Effective STL" Scott Meyers
# "Exceptional C++" Herb Sutter
# "More Exceptional C++" Herb Sutter

The first, Accelerated C++, will cover all the fundamentals.


NickGravelyn, i was in the same situation like you, and now I am reading Accelerated C++... I think it's a really great book...
Quote:Original post by frob
The standard list of books to read are:

# "Accelerated C++" Andrew Koenig and Barabara Moo
# "The C++ Standard Library" Nicolai Josuttis
# "Effective C++" Scott Meyers
# "More Effective C++" Scott Meyers
# "Effective STL" Scott Meyers
# "Exceptional C++" Herb Sutter
# "More Exceptional C++" Herb Sutter

The first, Accelerated C++, will cover all the fundamentals.


I'd second this list of books, mostly because this is practically the same list I read with the exception of Accelerated C++.

I also read C++ Templates: The Complete Guide by Nicolai Josuttis & David Vandevoorde which if you want to know more than you ever needed about templates is a good book (and was the final book I read before moving onto Modern C++ Design by Andrei Alexandrescu , a book I brought, read 80 pages of, realised I didn't have a clue what it was on about and sent me on a journey through the books listed above).

Quote:Original post by phantom
a book I brought, read 80 pages of, realised I didn't have a clue what it was on about

"Exceptional C++" had that effect on me. It's really funny when you think you know a language decently well, and then you read a book that feels like it's talking about a completely different language. What? This is C++?? :)

This topic is closed to new replies.

Advertisement