REVIEW - C++ Solutions - Companion to The C++ Programming Language, Third Edition

Title:

C++ Solutions - Companion to The C++ Programming Language, Third Edition

Author:

David Vandevoorde

ISBN:

Publisher:

Addison-Wesley (1998)

Pages:

292pp

Reviewer:

Brian Bramer

Reviewed:

April 1999

Rating:

★★★★★

A useful book that can be used to check ones solutions to exercises in The C++ Programming Language.

The subtitle of this book is 'Companion to The C++ Programming Language Third Edition by Bjarne Stroustrup'. It provides solutions to selected exercises and expanded comment on the text.

After an introductory chapter explaining the context of the book and its relationship with The C++ Programming Language 3rd ed chapters 2 and 3 are a quick tutorial on C++ language fundamentals - not aimed at teaching C++ but to remind the reader about important concepts. From chapter 4 onwards the chapters map to corresponding chapters in

The C++ Programming Language . Each exercise is reviewed and usually followed by a 'hints' paragraph which points out related material (exercises, text, etc. which is relevant to solving the exercise). A solution or several alternative solutions are then presented together with a discussion about the approach taken and the merits of alternatives, e.g. in terms of portability, performance, memory usage, etc. This is often followed by supplementary exercises to extend the readers knowledge and experience.

For example, consider Exercise 5.4 (page 105 of

The C++ Programming Language ) where solutions to the swap function are presented using
int*
and
int&
as the parameter types. There is then a supplementary exercise to consider the following possible solution (which removes the need for a temporary variable):

void swap(int&int1, int&int2) { 	int1 = int1 ^ int2; 	int2 = int1 ^ int2; 	int1 = int1 ^ int2; }
The user is encouraged to check that this works (in most cases), to implement some simple benchmarks to compare this with the other solutions and then to explain why it is not recommended.

A useful book that can be used to check ones solutions to exercises in

The C++ Programming Language . Explanations are clear, often with alternative solutions compared and with plenty of cross-reference to The C++ Programming Language . Watch out in case you have set some of the exercises as coursework for your students! Highly recommended!

Book cover image courtesy of Open Library.