Here is a collection of annotated references and web-page links, together with a bit of introductory material of my own, on the general topic of the C++ programming language.
Table of Contents:
Link to my web page on C programming.
Link to my web page on numerical programming.
Link back to my home page.
To quote from Bjarne Stroustrup's web page on C++,
C++ is a general purpose programming language with a bias towards systems programming that
- is a better C
- supports data abstraction
- supports object-oriented programming
- supports generic programming.
C++ is a powerful and sophisticated language. For the skilled programmer, it can be used to tackle large and complicated projects much more effectively, and at a much higher level of abstraction (i.e. being bothered by much less extraneous detail) than (say) C or Fortran.
However, by virtue of the very (desirable) features which make it so powerful, C++ is also a large and complicated language, and it's not easy for a beginner to learn C++ in its full complexity. Fortunately, one can work usefully in C++ knowing only a small subset of the language, consisting essentially of C (modulo a few minor exceptions, C++ is in fact a superset of C), together with a small number of new features. One can then gradually learn further more-sophisticated features of C++ as the opportunity and/or need arises.
However, C++ still shares C's basic philosophy of assuming the programmer knows what s/he is doing. C++ does provide considerably more protection against some common mistakes than C does, but at the same time C++'s (much) greater power makes it all the more dangerous if misused. That is, it's painfully easy for a minor mistake in a C++ program to result in (say) a program which appears to work ok, but is far less efficient than it should be, will give wierd errors if you later try to modify the code in certain ways, or just crashes with confusing and hard-to-diagnose symptoms.
I recommend the GNU Project's GNU Compiler Collection, commonly known as gcc. This is an excellent compiler which actually handles C, C++, Fortran, Java, Chill, Ada, and maybe also some other languages I don't remember right now. gcc is much closer to the official C/C++ language standards than Microsoft's compilers, for example. [In fact Microsoft's compilers are notorious for egregious violations of the language standards -- Microsoft's business model doesn't call for making it easy for their users to switch to other vendors. :( ]
You can download a GCC source distribution from the GCC web pages. If you're using a Unix-flavored computer system and you have at least a little computer background, this is the best way to get an up-to-date compiler. (Since gcc is written in C, you'll need some existing C compiler (just about any one will do) to bootstrap the process. But that shouldn't be a problem -- most Unix-flavored systems already come with a C compiler, or if not you should be able to find binaries of some older gcc version somewhere on the net.)
If you're stuck with Microsoft Windows in any of its incarnations, there are a couple of different GCC ports available, which you can download as binary distributions. Two good ones are
Steve Heller,
Who's afraid of C++?
(Addison-Wesley / AP Professional, 1996, ISBN 0-12-339097-4)
(The full text is also available
online.)
I haven't personally seen this book, but it comes recommended by
the
comp.lang.c++ Frequently Asked Questions List
as a good C++ book if you don't know any other
programming language. It's also recommended by
Eric S. Raymond
in
The Linux Reading List HOWTO's
section on
Books on C and C++ Programming.
The University of Cambridge Department of Engineering's C++ Web Site has links to several good online tutorials (and lots of other good stuff, too).
Stanley B. Lippman and Josée Lajoie,
C++ Primer, 3rd Edition
(Addison-Wesley, 1998, ISBN 0-201-82470-1)
This is an excellent book from which to learn C++: it starts at
the beginning, and winds up covering just about all of the language.
It's fully up-to-date with respect to the ANSI/ISO C standard.
It assumes you're already familiar with basic block-structured
programming concepts, but it does not assume you already
know C. If you're only going to buy one C++ book, and you want to
become fully fluent in the language, this should be your book.
Unfortunately, because it covers all of C++, this book
is pretty big (1200+ pages).
Andrew Koenig and Barbara Moo,
Accelerated C++
(Addison-Wesley, 2000, ISBN 0-201-70353-X)
This is a beginners' C++ book with a difference -- it focuses on
using the STL (standard template library) from the beginning.
Unlike Lippman and Lajoie, it deliberately covers only a subset of the
language. The payoff is in size/length -- unlike books which cover all
of C++, this book is relatively short and lightweight.
Stanley B. Lippman,
Essential C++
(Addison-Wesley, 2000, ISBN 0-201-48518-4)
This is a fairly short beginners' C++ book -- a bit under 300 pages,
which only covers the most commonly used language features. Its
presentation is fairly standard -- it doesn't have the heavy STL
emphasis of Koenig and Moo. It's "just" an excellent introduction
to C++. (If you know Perl, you could think of this book as sort of
like the Llama book.)
The comp.lang.c++ Frequently Asked Questions List,
available from sites in
USA (1),
USA (2),
USA (3),
Canada,
Finland,
France,
Germany,
Ireland,
Spain,
and
Taiwan.
This is Marshall Cline's superb
Frequently-Asked-Questions list for the comp.lang.c++
Usenet newsgroup. It covers a lot of frequently-confused
topics in C++, both elementary and more advanced, and I recommend that
anyone doing nontrivial C++ programming at least skim through it, and
preferably take the time to read through it in detail. An
expanded form of this FAQ
is available in book form.
Marshall P. Cline and Greg A. Lomow,
C++ FAQs
(Addison-Wesley, 1995, ISBN 0-201-58958-3)
This is a very nice book containing about 470 short questions and
answers on C++, covering at lot of the common traps and pitfalls.
Even though it's almost a decade ago, it's still very good reading!
The
comp.lang.c++ Frequently Asked Questions List
is a condensed and hyperlinked version of this book's contents, but
there's enough extra detail in the book that I think the book is well
worth buying even after you've worked through the
online FAQ.
C++ Web Site from University of Cambridge's Department of Engineering Lots of good C++ resources here, including a large section on learning C++ (which in turn includes links to several online tutorials).
C++ Annotations
This is an online introduction to C++ for C programmers.
An Introduction to C++ for C Programmers
This is a 2-part pedagogical talk I gave to the
AEI
numerical relativity group
in August 2004:
Bjarne Stroustrup's C++ Style and Technique FAQ
This is a nice short FAQ on C++ style & techniques issues, by
the language designer himself.
The comp.lang.c++ Frequently-Asked-Questions List and the expanded C++ FAQs book both have a lot of material on C++ style and usage.
Cargill,
C++ Programming Style
This book is getting a bit old by now, but it's still excellent.
Each chapter starts with a complete example C++ program taken from
some other C++ text, then critiques it and rewrites it to be easier to
understand and modify, more efficient, more portable, etc etc. I found
this book a lot of fun to read!
Bjarne Stroustrup's Advice on How to Learn C++
Stroustrup was the designer/inventor and original implementor of C++.
This is a message he posted to the comp.lang.c++
Usenet newsgroup way back in 1993 or so, offering his advice for how
one should go about learning C++.
Bjarne Stroustrup,
The C++ Programming Language, 3rd Edition
(Addison-Wesley, 1997, ISBN 0-201-88954-4)
This is the granddaddy of all C++ books (Stroustrup was the
inventor/designer of C++). It's very clearly written, and it covers
all of C++ in reasonable detail. I think it's a beautiful treatment
of the language for the programmer who's already fully fluent in C or
a similar language. But it's big, covers a lot of material, and it's
not easy reading for the beginner. Alas, its table of contents is
just about useless -- it lists only chapter titles, not sections,
subsections, subsubsections, etc. Stroustrup offers an
expanded table of contents on his web page, listing all the
sections, subsections, etc, but this is still awful -- it omits almost
all page numbers!.
Bjarne Stroustrup,
The Design and Evolution of C++
(Addison-Wesley, 1994, ISBN 0-201-54330-3)
This book is about why various features of C++ are the way
they are. For the intermediate to advanced C++ programmer, there's a
lot of insight here.
Andrew Koenig and Barbara Moo,
Ruminations on C++
(Addison-Wesley, 1997, ISBN 0-201-42339-1)
This is another book of columns, this time ones by Koenig in
Journal of Object-Oriented Programming,
C++ Journal, and C++ Report.
Again, they've been expanded and rewritten for the book.
Herb Sutter's web site and his books
comp.lang.c++.moderated newsgroup form
the basis of this book, but he's extensively revised and expanded
them for the book.
Bjarne Stroustrup's Web Page on the C++ Programming Language
Bjarne Stroustrup's Home Page
Stroustrup was the designer/inventor and original implementor of C++.
His web site has links to lots and lots of C++ information, along with
a few other goodies.
Carlos Moreno's STL Tutorial
Mumit Khan's STL Tutorial (unfortunately quite out of date)
Here are two online introductory tutorials on the C++ STL.
Unfortunately, Moreno is a bit carefree in his use of namespaces. :(
C/C++ Users Journal's
C++ Experts Forum
These are a series of monthly columns by the former columnists of
C++ Report (now defunct). The columns are excellent
and very readable.
Dinkumware's Standard C++ Library online documentation: detailed, hyperlinked, documentation for the C++ Standard Template Library (STL).
Comeau Computing's
Tech Talk about C++ and C
This is a very good C++/C frequently-asked-questions list by one of
one of the main C++ compiler vendors. They also have an excellent
Templates FAQ.
Boost.org is a web site for exchanging peer-reviewed C++ (source code) libraries. The emphasis is on libraries which interoperate well with the STL, and share its design philosophy. Boost has some peculiar licensing restrictions (it forbids GNU GPLed or other ``open source'' libraries), but there's some useful code available.
My Web Page on Calling Fortran Subroutines from C
A lot of excellent numerical software is written in Fortran, so it's
often useful to use this software (i.e. to call Fortran subroutines
and/or functions) from C and/or C++ programs. This is a web page I
wrote on how to do this (C only, not C++), as well as how to write
C functions which can be called from Fortran code.
Everything on this page is valid for C++ as well as C;
sometime soon I'll revise it to also cover "specifically for C++"
techniques.
Sean Corfield's C++ Beyond the ARM Web Pages
This is a nice web site devoted to explaining recent changes/additions
to C++, i.e. things which you might not (yet) find in C++ books.
The
Mozilla C++ Portability Guide
Some ugly guidelines on what C++ features to avoid if you want your
code to be portable to even the most archaic and buggy of compilers.
Fortunately, most compilers are now starting to converge on the ANSI/ISO
C++ standard. (Microsoft's compilers are the main exception, alas.)
Dietmar Kühl's C++ Page
This includes several array classes (even an arbitrary-dimensional
one using fancy recursive templates). However, note that the C++
standard draft and GCC information here is many years out of date.
Matthew H. Austern,
Generic Programming and the STL
(Addison-Wesley, 1999, ISBN 0-201-30956-4)
As well as standardizing the C++ language, the ANSI/ISO
C++ standards committees also standardized a large and sophisticated
standard template library, commonly known as the STL.
Because it's new, and because it's heavily based on templates, most
older C++ books don't cover the STL. Austern was one of the principle
authors of SGI's implementation of the STL, and his book offers an in-depth
treatment of the STL.
Link back to Jonathan Thornburg's home page.
$Revision: 1.7 $ of $Date: 2007/04/06 07:45:48 $.