Mentioned in questions and answers.

Just would like some thoughts of what you think about my strategy to learn C++. While I understand that it takes years to master a programming language, I simply want to get to the point where I can be considered competent as quickly as possible. Why quickly? Well when I say quickly I'm really saying I'm committed, and that I don't want it to take forever where forever is never. If it takes five years to become competent, it takes five years. I'm not expecting 24 hours or 30 days.

About me: I don't have a CS degree, I have an anthropology degree and a Masters in library science. Learning the CS fundamentals such as Big O notation, and basics such as binary trees and linked lists, sort algorithms has been a challenge. Probably nothing substitutes a good CS degree. :( I do have many years programming experience, starting with PHP in 2001, ActionScript, 2003, JavaScript soon after. I have been writing programs in Python for about two years now and I have learned C (by reading the K&R book and writing some programs), but I'm probably not going to get hired for a C job. Also recently learned Objective C. I work as a JavaScript & Python, & CSS developer at a website at the moment.

Anyhow, this is my strategy: Read the Stroustrup book (I just started on Part I) and at the same time start a simple C++ project, while also doing many of the Stroustrup exercises.

Thoughts?

Also be sure to check out How Not to Program in C++

Bjarne's book is fantastic, especially for C++ syntax, but the one book that will really make you a competent C++ programmer is Meyers' Effective C++. Get it. Read it.

I as well do not have a CS degree, but I work for a silicon valley startup. It is possible, you just have to be aware of what's out there and never stop learning. Many students who graduate with a computer science degree end up working in a language they didn't study, so be sure to hit the fundamentals. If you hear something that's unfamiliar to you, be sure to find a good book and a coffee shop and get to it. The C++ will come in time - with Stroustrup and Meyers, you've got 90% of what it takes to be good at C++

If you have a strong handle on C, then C++ is not a huge leap once you have a good handle on the OOP concepts....which hopefully you have from becoming proficient in Python. Coming from C, the biggest thing to learn in C++ is really getting familiar with the Standard Template Library (STL) and all the subtle things come along with using it.

Personally, I think the Stroustrup book is not all that great for learning the language, it's more of a reference. I would recommend C++ Primer Plus as a better book and the Effective C++ books by Meyers for really learning to use the language coherently.

I don't htink the Stroustrop book is a good place to start. It's more of an advanced/reference book. I would start with Thinking in C++ (Volume 1) (and Volume 2. And write lots of code. Once you've got a basic handle on the code I would get the Scott Meyer Effective C++ books and definitely the Stroustrop book.

what is the most advanced c or c++ book you ever read? i am asking this because i already read lots and lots of books on c and c++ on a lot of topics including (object oriented programming-data structures and algorithms-network programming-parallel programming (MPI-PThreads-OpenMP-Cilk-Cuda)-boost library....). So whats next. I still want to advance.. especially in c.

Hey nobody mentioned about Bruce Eckel's Thinking in C++ Volume 1 And Volume 2. When I read it as the first book it went straight way above my head. However as now I have good experience and have read books like Effective/Exceptional C++ so Eckel's book is now an ordinary stuff. However no doubt its a very popular book (4.5 stars on Amazon - 84 customer reviews).

Large Scale C++ Design by John Lakos.

Practical advice on managing the complexity of compiling/linking and executing large C++ programs. Talks a lot about decoupling and how to avoid the many kinds of dependencies that arise in C++.

(This is something most C#/Java developers, and sadly some C++-devs too, rarely understand. IMO, it's a pain they need to. I wish we had modules in C++ already.)

My favourite "difficult" C++ book is this Template Metaprogramming one: C++ Template Metaprogramming: Concepts, Tools, and Techniques from Boost and Beyond.

You really want to test your mental limits? Then try these:

Alexandrescu: Modern C++ Design

Abrahams&Gurtovoy: C++ Template Metaprogramming

These books look deceiptively thin, but they stretch the limits of template programming, your C++ compiler, and your brain.

It seems to me there aren't half as many books about C programming as there are about C++. The language just isn't that complex.

One interesting read might be P. J. Plauger The Standard C Library. It is supposed to contain some masterful code. It's on my to-read list.

I am not sure if you would consider these advanced, but I would surely put them in the category of must have references:

The C++ Programming Language Special Edition (3rd) by Bjarne Stroustrup

The C++ Standard Library: A Tutorial and Reference by Nicolai M. Josuttis

The other books I would recommend have already been listed by others.

i have been programming in C/C++ for my academic courses a lot and was under the impression i had a pretty good grasp of it. but lately i had to work in a bluetooth application that had a server and client implementation in a Linux box and an embedded system. i learned bluez bluetooth API, socket/network programming and coded it.

however i ran into a lot of problems with memory leaks and segmentation faults and other memory related errors along the way.as the code grew more complex i all but lost control of the pointers and threads and sockets. this got me wondering that i had a lot to learn that they didn't say in the basic C/C++ books. so i wanted to ask for the resources that are available that'll help be code better in a professional way in C/C++ .especially for the Linux/Mac environment (gcc compiler).

Edit: changed C to C++ because of the confusion it was creating.

My starting advice for dealing with memory and correctness issues in your code starts not with the language but with software practise in general:

  • Program a bit at a time, then test.
  • Test, test, test! Unit test wherever feasible. Catch errors early and incrementally.

I've found through hard experience that C and C++ will be sure to punish you, the longer you go without testing your code. I'll bet you've tried to debug enough of these issues to know that finding a problem in an untested code base of nontrivial size can be baffling and painful.

For books that will help you develop discipline along these lines, I recommend as one starting point The Pragmatic Programmer, Andrew Hunt and David Thomas, Addison-Wesley Professional, 1999.

Tips I have specific to C and C++ are:

  • Don't dynamically allocate unless you need to.
  • Watch your dynamic memory allocation (malloc/new) like a hawk. Make sure you've thought out exactly who owns the objects, and is responsible for deleting them, once they've been created – even in the case of exceptions! (That's where Resource Acquisition Is Initialization comes in.) Design your code so that this ownership is logical and predictable.
  • Use Valgrind, Purify, and other such tools to help catch and diagnose memory issues.

The two books on Stack Overflow's Definitive C++ Book Guide and List (an excellent list, btw!) that I think will help you most along these lines are: