[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: C++ textbooks: recommendations?

On Tue, Apr 04, 2006 at 05:50:48PM -0500, dick_(_at_)_uchicago_(_dot_)_edu wrote:
> i need to learn C++, but do not know where to begin with textbooks
> or online docs. since, AFAICT, there are a great many skilled
> programmers on list, i would appreciate any recommendations that
> can be made about introductory and intermediate texts on C++.

There's a good collection of reviews on C/C++ books at the
"Association of C/C++ Users" website:


I've bought a couple books based on reviews at that site, and have
been happy.  (Note that I'm not a member or anything, I just found
their website useful.)

It's already been mentioned, but it's worth repeating: Bjarne
Stroustrup's book, _The_C++_Programming_Language_ will teach you a
*lot* about C++.  I don't recommend it for beginners, though.  It's
pretty terse (but very thorough).

> my motivation for asking this is to avoid purchasing texts that
> will sit on my shelf and collect dust. there are a great many
> introductory texts on nearly every subject that do just that
> and/or don't cover enough material in sufficient depth.

I hear that.  Caveat: everyone learns differently.  But, in general,
I've found that reading existing code and writing sample programs is
the best way to learn.  I've also got a lot of good feedback from
Usenet (comp.lang.c++ I think).

The only problem, in my opinion, is that if you pick up some code
and start looking over it, you may learn bad habbits or techniques.
Thanks to the gaining popularity of the open source movement,
there's more free example code out there than you could look at in
your lifetime.  The downside is, without experience, you don't know
what's good and what's bad.  Obviously you want to be looking at
well-written code.

Another idea might be to get involved in a C++ open source project
(one that interests you obviously).  Code up a feature, submit it,
and see what kind of feedback you get.  (This assumes that, like me,
"learn by doing" is the best way for you to learn something.)

> are there any texts on best practices for writing exploit-free
> code? if you feel this is insufficiently openbsd related, please
> reply off-list to reduce chatter.

Not that I've found.  You can certainly find tons of tidbits and
best practices by searching the web.  General rule of thumb: buffer
and array bounds problems are probably the number one killer in C
and C++ applications.

It would be awesome if the collective expertise of the OpenBSD
development team could be captured and put into book form (and I
suppose it is, to a degree, in the code itself).  Even though
OpenBSD is "vanilla" C, generally good practices in C are good
practices in C++.

Hope that helps!