Previous section   Next section

Imperfect C++ Practical Solutions for Real-Life Programming
By Matthew Wilson
Table of Contents


Part Three: Language Concerns

The new author's almanac of good writing principles advises that the first sections of a book should represent a gentle introduction to the overall subject matter, covering basic concepts and laying firm foundations for later material. They should provide the reader with an opportunity to get a feel for the author's writing style and way of thinking, and should make them comfortable with the material. Later chapters should build on this knowledge, gently steering the reader through the increasing complexity in an incremental fashion.

Well, I've got most of that right. The material in these six chapters covers several fundamental issues, and, though more complex than previous chapters, does not make huge leaps into daunting territory.[1] Nonetheless, I can't promise that you're going to be entirely comfortable: some of the imperfections in this part are best taken with a bar of chocolate and a lie down.

[1] I'm saving that for Part Four.

In a bike race, we'd be entering territory with many short, steep foothills. There's nothing to do but grin and bear it, keep up with your teammates, and keep telling yourself that the pain in your legs is necessary to get them properly warmed up for later.

Many of the imperfections described in this part identify "imperfections in the small." In other words, the imperfections are discrete and relatively minor in nature and in the problems that they cause, and the solutions are consequently reasonably straightforward and modest in scope. But almost all highlight important issues that we will return to later in the book, as we move toward some "imperfections in the large" in Parts Four and Five, and look at extending C++ in Part Six.

Several items touch on contentious issues. We cover the virtues of expression layouts, criticisms of the bool type and the handling of Boolean values, issues with literals, and problems with "implementation-defined" behavior. I suggest that there are missing keywords, the new for-scoping is broken at best, and recommend the use of a reinvigorated NULL. I even have the temerity to suggest that C++ needs a whole new cv-qualifier! I hope you'll bear with me as we look at issues that may raise your eyebrows, or your blood pressure; reading a book called Imperfect C++ must mean you're prepared for some controversy, anyway, don't you think?

There are six chapters: Chapter 13, Fundamental Types; Chapter 14, Arrays and Pointers; Chapter 15, Values; Chapter 16, Keywords; Chapter 17, Syntax; and Chapter 18, Typedefs. I hope you learn several new things, are challenged at times, and gain a new appreciation for the subtleties, the flaws, and the underlying strength of C++. The perspective in all cases concerns how best to write code that is correct, efficient, and robust in the face of maintenance. When you've made it through, I expect that you'll want to see how the imperfections and solutions highlighted here will affect the remainder of our journey into C++'s dark corners.



      Previous section   Next section