[Gllug] c++ newbie complier probs

Nix nix at esperi.demon.co.uk
Thu Oct 24 22:50:37 UTC 2002


On Wed, 23 Oct 2002, Tethys mused:
> Jonathan Harker writes:
> 
>>For a very good book on C++ from the horse's mouth, I recommend Bjarne 
>>Stroustrup's book The C++ Programming Language. It is only available in
>>dead tree format, but I refer to it all the time.
>>   http://www.research.att.com/~bs/homepage.html
> 
> No, no, no!!!!! I'd recommend that *anyone* learning C++ stay well
> clear of this book. The guy may have designed the language, but when
> it comes to explaining it to others, he's useless. It's apallingly

I concur :( it's a nice reference, but a poor tutorial.

> written (in stark contrast to K&R, for example), and there are *far*
> better alternatives available. I quite liked "Teach yourself C++", by
> Al Stevens, MIS Press (beware the numerous other books with the same
> name).

It gets moderate marks at the ACCU review site; it's probably not bad :)

The C++ books I rank as `indispensably useful' and keep by my side
(except when I lose them, which is too often) are, going from most
tutorialish to most referential:

- Lippman and LaJoie's _C++ Primer_ (3rd ed is out now but I have only the
  2nd); useful even after you've learnt C++ and a superb tutorial.
  (Well, I imagine it would be, although I read it after I'd learned
  C++ and liked it a lot anyway).

- Both Meyers books (_Effective C++_ and _More Effective C++_): a
  wonderfully detailed and very well written `cookbook-like' set of
  guidelines for how to use all that syntax to *do* something. Don't
  let the `cookbook-like' mislead you; it's the *reasoning* for why
  things are done that's really important. The biggest failings of
  these books is that they don't go into the C++ standard library.

- The _STL Tutorial and Reference Guide_ by Musser & Saini; you cannot
  presume to know C++ without knowing the STL (that is, the
  data-storage-and-algorithms parts of the C++ standard library; this
  actually originated in Ada but migrated to C++ because Ada proved
  insufficiently expressive).

- _Generic Programming and the STL_, by Matt Austern; an STL reference
  work distantly derived from the SGI STL web pages, but with *so* much
  more info and examples in that I find I have trouble using the STL
  much without this book nearby.

  This book's useful as a reference work not least because Matt is a C++
  deity of very high order: if he says something is so in this book and
  it turns out not to be so, it's *really* likely that your code (or
  your compiler) is at fault and not the book. Matt has been known to
  be wrong, but it's not at all common. ;)


  Be warned, the previous two books will twist your mind inside out:
  after reading them you'll have trouble writing a data structure
  or a manipulator of data in any language without pining for the STL
  so you can write them *properly*.

- `Exceptional C++' by Herb Sutter. These are C++ Guru of the Week
   articles (from comp.lang.c++.moderated), radically expanded and
   souped-up and turned into a book. Wonderful, mind-expanding but
   heavy going fare :)

- The C++ Standard. Almost impenetrable, but if you're really stumped
  or want the Indisputable Truth and can read standardese, this is
  what the compiler hackers read.

Also, the Stroustrup is quite useful, but only to teach you the syntax,
really, and what matters about C++ is how you *do* things with that
syntax.


A major problem with C++ books is that the language is complex enough
that most authors have only a partial view of it, and so their books
give either an outright wrong view (hello, Herb Schildt), or, at best, a
partial view, omitting important parts of the language because they
don't know enough about those parts to write about them. Most C++ books,
even now, fall into the latter category, rabbiting on about classes for
ever and a day but never mentioning templates, even though templates are
so fundamental to C++ that you can't even write `hello world' without
instantiating a templated class!

Some books have overcome this, but not enough. In my opinion, the books
above have; others doubtless have as well but I haven't read them
yet. :) And none of these (except perhaps the Sutter book) will teach
you the *really* interesting stuff, things like template metaprogramming
and the use of policy classes --- if just because some of this stuff is
still being hammered out :)


Oh, and you probably need a book or something to teach you OOD if you
plan to use C++'s OO features much (which is *not* required: 90% of my
C++ programs make no use of objects as anything more than an
encapsulation feature... templates are a *far* more important language
feature than classes.)

And check out the Boost libraries (at <http://www.boost.org/>; they're a
sort of training-ground for C++ stuff that is portable and generally
useful; it was started by a bunch of Standard-committee members, so
parts of it can be reasonably expected to find their way into the next
revision of the Standard.

> Curiously, Stroustrup's "Annotated C++ Reference Manual" is much,
> much better. I suspect that's the result of having been co-written
> with someone that know's how to write...

Barbara Moo? You may be write there :)

_Ruminations on C++_, by Pike and Moo, is just as good, and more
up-to-date (although it covers quite different territory); the ARM is a
historical document nowadays, not a reference work.

My copy has got all covered in mould though. I must buy another.

-- 
`The tooth fairy teaches children that they can sell body parts for money.'
                       --- David Richerby

-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list