Book Reviews


The Complete C++ Primer

Reviewed by Sam Hobbs


Sam Hobbs is a nuclear engineer and project manager for GDS Associates. He has been involved with computers since 1966 and is an avid C fan. He assisted in the development of the Powerpro daily load forecasting and energy resource scheduling software package and the data conversion for the GrayBase nuclear power plant monthly operating report history database. Readers may contact Sam at GDS Associates, Inc., Suite 720, 1850 Parkway Place, Marietta, GA 30067, (404) 425-8100.

This is an excellent book for several different audiences. First for newcomers to object-oriented programming, this book provides a gentle introduction with a welcome lack of hype. Second, the book is a thorough introduction to the C+ + programming language. There is no implicit assumption that the reader is an advanced C programmer, but a sufficient knowledge to read simple, non-obscure C code is a practical requirement. A reader with little knowledge of C but a reasonable familiarity with some other procedural structured language can work through most of the book without any problems, but in one or two places there are short segments of code where not knowing C is a problem. The most prominent example is a brief section where the standard macros are used for a function with a variable number of arguments.

The principal virtue of this book is its simplicity and clarity. The discussion of reference variables is especially clear. When there are lingering questions, the authors nearly always provide an answer within a page or two. Most of the time, the question is explicitly anticipated by the authors with a brief statement that the material will be covered within a few pages or in the next section of the book.

Examples are chosen for their usefulness in explaining concepts in C++ and not because they are trendy or demonstrate how clever the authors are. As a result, most of the examples demonstrate how to use C++ in a very elementary way. The book is not a major repository of code which will be adopted by readers and used again and again; it is a place where readers will get the hard questions answered very clearly. Nevertheless, there are sections where the code demonstrates and suggests useful techniques that would not be immediately obvious to a beginning C++ programmer. Simple versions of iterator functions, using classes to define menus, and a memory buffer class demonstrate friends and inheritance. Function overloading and virtual functions are discussed with very simple-minded examples using several functions with one or two lines of code each and discussions of what overall program behavior results and why. Although these examples are simple almost to an extreme, the resulting clarity will serve the reader who really needs a primer far better than flashy and complex examples that are poorly understood.

Other than a very brief mention in Chapter one, the C++ input/output stream operators are not discussed until Chapter 10. This contrasts to the approach in many other introductory C++ books where the stream operators are introduced early and used intensively from then on. Each approach has advantages, but for an introductory text on an evolutionary language there are substantial advantages to not introducing an entire new notation from the beginning. By deferring the discussion until near the end of the book, the myriad of questions on how and why the operators are used as they are can be treated naturally and without confusion.

The book makes other departures from the customary organization of introductory books on C++. Objects and classes are introduced in Chapters two and three instead of near the middle or end of the book. The book then discusses new syntax and language features as they are introduced in light of the underlying rationale of C++ which is to add class and Object-Oriented extensions to the C language.

Two things are wrong with the book. First, the book is overpriced at $45.00. The pricing is consistent with pricing for books that are an academic introduction to a programming language, and indeed this book can serve that purpose well and with no apologies, but its primary market is likely to be broader and more diversified. A lower and more competitive price would make it a must have. The second fault is that the book does not cover version 2 of C++, except in scattered brief mentions throughout the text and in a short appendix. This fault is less serious, given the introductory nature of the book. A beginning C++ programmer can learn more than enough to graduate to vendor manuals or to more sophisticated materials by studying this book. I highly recommend this one despite the price disadvantage.

The Complete C++ Primer
Keith Weiskamp and Bryan Flamig
Academic Press, 1990
$45.00, 524 pages
ISBN 0-12-742687-6