|
|
| | Learning C++ in 2010 | |
38 points by martinp on Feb 12, 2010 | hide | past | favorite | 52 comments
|
| | I'm currently learning C++ for a project I'm working on. However, I do have a problem. The huge amount of (possibly incorrect) information Google returns leaves me a bit confused sometimes. Like PHP and many other languages, there's obviously a lot of bad code out there.
So I'm wondering what are the best resources for learning C++ in 2010? Has the best practices for C++ changed much in the last 10 years? The most valuable resource I have found so far is the Accelerated C++ book, is it still relevant? |
|

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact
|
Here are my tips for you. First tip: Don't trust any C++ code that anyone else writes. This is related to Meyers' tip that C++ is a "federation" of languages. As you have noticed, there is a lot of bad code. But even good code can have bad consequences. C++ is extremely idiosyncratic and the author will make assumptions that you will follow certain practices (deemed as "the right way to program in C++") which will vary from author to author. You may even start to notice this in the comments. Corollary: Only trust a library if it's very well documented and frequently used. Boost may be worth a look, and lots of people like it, but I can't promise that it works.
Second tip: avoid reference counting "smart pointers" whenever possible. This directly contradicts Scott Meyers. Instead, use valgrind to make sure your program doesn't leak memory. If your program is infeasible to write without automatic memory management, switch to a language such as Java or C# which is built atop a robust garbage collector.
Third tip: view C++ as a bit like an extremely sharp knife. Easy to get things done, even easier to cut your finger off. Just because an example looks slick and easy does not mean that using it in practice is slick and easy.