A few Tips for Choosing a C or C++ TextBook

How can you recognize a good textbook in C ?    a good textbook in C++ ?

Unfortunately, you cannot   -    unless you already know
the language in which you are interested.

Therefore, you will have to rely on someone you trust.
So ask a friend or a colleague to help you.
Luckily, The Association of C & C++ Users maintains a huge list of Book Reviews that is continuously updated (over 2100, by March 2000).

A Short Introduction
There are a lot of factors that make a good textbook (on a given subject) different from a bad one. Starting from the choice of the contents, then deciding in which order topics are to be presented, and finally the author ability to convey the subject in a clear and interesting way (including the choice of good examples).    All these are rather subjective choices and decisions, and any opinion about them is just this - an opinion.
Below, I have tried to give you some tips that help me in distinguishing between a good textbook on C (or on C++) and a bad one. It is my view that these tips deal with objective issues - how probable it is that you may acquire wrong information about the programming language in which you are interested.

Even when you follow these tips, you have to add your personal taste and preferences to your considerations in choosing the right textbook for YOU.
Marshall Cline says that you always need two kind of books:
One that tells you what is legal and
one that tells you what is moral.
It is my opinion, that it is true for ANY computer language, although he says it about C++.



A few Hints on what to ignore if you don't know any of these languages:

  1. If the book says it will teach you both C and C++ don't even take it for free. C and C++ are two different languages. It is fair to say that C++ was developed on top of C's syntax, but semantically they differ a lot (though some basic constructs do have the same semantics).
    See 2nd paragraph at alt.comp.lang.learn.c-c++ FAQ Q#2 (temporary link).
    See 2nd paragraph at alt.comp.lang.learn.c-c++ FAQ Q#13 (temporary link).
    Not convinced ? Read the first two sentences of C++FAQ, 27.3.
    In the Book Version of C++ FAQs, it is said:
    #396: How long does it take a good C programmer to become a good C++ programmer ?
    Ans.: That's the wrong goal; instead become a good OO programmer who uses C++.
    #397: How long does it take a good C programmer to become a good OO programmer ?
    Ans.: Six months to three years, depending on your definition of good.
    (Note what it does not say: It does not depend on your knowledge in C. Y.K.)

    With a slight exaggeration you can compare the relationship between C and C++ to the relationship between (but not the evolution of) English and French. Though French includes all of the English alphabet, with a few added letters and punctuation marks, you cannot say that "French is an extension of English", can you ?

    If you already got it for free, you can always use it for stabilizing a table, or lighting up your next girl-scout fire.

  2. If the book doesn't even claim that it describes the standard language (usually referred to as ANSI-C, ANSI-C++), you may find yourself learning a specific dialect of a specific compiler.
    As in any case of addiction, it's hard to get off the hook.
    See 2nd paragraph at alt.comp.lang.learn.c-c++ FAQ Q#13 (temporary link).

    Nevertheless, if the book does claim that it teaches the standard language, you have no way of telling whether this claim is justified - unless, of course, you know the language.

  3. Here are two examples of how to try to identify the non standard-conforming books:
  4. Does the book have an appendix that describes (via header files) the standard library that is part of the language ?

    In C, some common header files are stdio.h, stdlib.h, math.h, ctype.h, and some less common are limits.h, setjump.h, locale.h.

    In C++, the C headers are part of the language (though the new standard for C++ has modified a few definitions, and in order to make them explicit, the header files names were modified too - e.g, math.h becomes cmath - but they are also accessible via their traditional C names). As a result, some good books on C++ may not describe the content of header files originated from C. But they should describe header files that are special for C++, some of which are iostream, iomanip, complex, stack, typeinfo. Old versions of C++ have the same file names with a .h suffix - just as C headers (e.g, iostream.h).

  5. For a C++ book, does it describe (at least the basics of) STL (the Standard Template Library) ? Does it describe exception handling ?

  6. How rich is the Index part of the book ?
    For comparison, K&R2, which is a 260 pages book, has over a thousand (1000) entries in its index !

A few More Hints about what to look for if you know a little about any of these languages:

  1. Does the book mention that the results of the operations / and %
    may vary on different computers for negative integers ?

  2. Does the book mention that the results of converting
    a negative floating point object into an integral object
    may vary on different computers ?

  3. Does the book say anything about quality programming ?
    If it uses global variables, if it has ANY function which is too long, if most of the variables names are less than 4 letters long and are meaningless (e.g, a, b, c1, c2, num1, num2), then whatever it says about quality programming is meaningless.
    Note, however, that the variables i, j, etc. are considered meaningful as indices for loops, and variable names like num, vec, etc. are meaningful under certain circumstances.

A few More Hints on what to look for if you know quite a bit about any of these languages.

  1. Examine how the book deals with data-structures.    Does it deal with them at all ?
    Probably those that do will show you how to implement a linked list.
    See how the book defines the data fields and how it defines the interface. Does the implementation encapsulate and hide implementation details? Does the book teach how to correctly use user-defined header files ? Does the book show how to make the list an ADT (Abstract Data Type) ?




Conclusion: This page may become redundant if too many authors take it seriously.
If this is the case - this page will make more than it promises.
But, if it happens at all, it will take some time.



e-mail: mailto.html



A few References:

Go to:

    Bad Books on C and C++
    C++ Bad Books
    Text Books
    More References
    Yechiel Home Page


This page has been visited [counter] times since 1998/4/13.

Copyright © 1998-2000 Yechiel M. Kimchi. All rights reserved.
http://www.cs.technion.ac.il/users/yechiel/CS/ChoosingBooks.html
Created: 1998/4/13       Last updated: 2002/10/10 20:30 IST

CopyRight Notice:
You are allowed to print this page for personal use.
Copying this page, or complete sections of its (textual) content, using any kind of medium, form or format, or including this content as part of a larger document, is permitted, provided:
  1. You inform me before doing so.
  2. Sections are copied in full - neither trimmed nor modified.
  3. An adequate reference for the source and appropriate credit for the author is given.
  4. This copyright notice is copied in full.
If you want to distribute this page, you will have my permission provided that:
  1. You inform me before doing so.
  2. You distribute this page in full, including its copyright notice.
You are allowed to create any number of links to this page, or to any part thereof. You are kindly asked (but not obliged) to inform me about these links and their (URL) locations.