REVIEW - C++ Primer


C++ Primer


Stanley B. Lippman, Josée Lajoie


Addison-Wesley (1998)




Francis Glassborow


August 1998



Thanks to the authors we have an introductory text that sets a standard for others to aspire to.

For a variety of reasons I never got to read either of the previous editions of this book. I have to admit that reading some of the lead author's other books have not encouraged me to make the effort required to get my hands on them. Perhaps this is a case of 'religious' disagreement. In other words Stanley Lippman and I often disagree on what programmers should be taught.

On the other hand Josee Lajoie is one of my favourite people. I have happily worked under her direction and contributed my small bit to the discussions of Core 1 subgroup of WG21/J16. The addition of her as a co- author of this new edition immediately moved the title from 'I must have a look at that some time.' to 'I must look at that now.' I have not been disappointed. That is not to say that I always agree with the authors. For example, I never use C style comments in my code except to comment out code (the use of preprocessor directives to do this does not make the excluded block visible, commenting out code changes its colour). I do not use

to provide global overloads of operators. I greatly prefer the new idiom for assignment that, among other things supports rollback or commit in an exception-throwing environment.

I mention all the above so that you understand where I am coming from.

This book is a massive introduction to C++. It has been written with an awareness of modern C++ rather than the older versions that most other books use. It starts using the powerful C++ Library right from the start and does not waste time demanding that you learn older and largely superseded methods that traditional C++ imported from C. Good programming (multi-file, header sentinels, stub functions etc.) are in use from chapter 1. The authors cover object-based and procedural programming as well as pure OOP.

My caveats above are very much personal alternatives and possibly counsels of perfection. Let me give you another example. On page 159 the first sentence on the conditional operator is:

The conditional operator provides a convenient notational alternative to simple


I once made a similar claim and was rightly corrected by having my attention drawn to the difference between an expression and a statement. The conditional operator evaluates to a value,

statements do not. For the inexperienced reader the book's statement is acceptable but readers need to note that some degree of simplification exists in the presentation. This is the kind of place that I would like to see a footnote or an endnote.

Its target readership is people with some programming background though not necessarily in C. Like all good books for newcomers to C++ you must be willing to work at understanding the authors. They write clearly and have a well-considered approach to introducing the reader to C++ but that does not excuse the reader from doing their bit by thinking about what they read. You may think that is obvious but many people seem to think that you can read a book on programming with the same casual attitude that you apply to reading a novel. Reading books on programming is much more like reading a book on mathematics, you need a paper and pencil or keyboard and text editor readily to hand. You cannot learn to program in the bath. Ideas and insights can come in such an environment but only after you have put in the hard graft.

If you want to learn to program in C++ as it is intended to be used and believe that you have some talent for the subject then this is the best place to start that I have found. Experienced programmers with some understanding of C++ (perhaps based on using a more classical version) might want to skip this one and move straight to Bjarne Stroustrup's The C++ Programming Language 3rd ed but most will benefit from working through both. C++ Primer 3rd ed is not the only book you should read, and you should not consider it as a definitive volume giving the one true way but it is an excellent basis from which to explore alternatives. If you are serious about learning C++, read and study this book. When you have finished you should then start reading and studying other books.

If you are already a competent C++ programmer, having a copy of this book to hand might solve the problem of the workshop pest who constantly wants instant answers from you. Just tell them that they need to be familiar with the contents of this book before it is worth your going into detail. If they are willing to work through C++ Primer 3rd ed they just might be worth some of your time to progress beyond it.

Thanks to the authors we have an introductory text that sets a standard for others to aspire to.

Book cover image courtesy of Open Library.

Your Privacy

By clicking "Accept All Cookies" you agree ACCU can store cookies on your device and disclose information in accordance with our Privacy Policy and Cookie Policy.

By clicking "Share IP Address" you agree ACCU can forward your IP address to third-party sites to enhance the information presented on the site, and that these sites may store cookies on your device.