|
C
++
is a multi-paradigm programming language; that is, it supports close-to-the-machine
programming as well as high-level approaches such as object orientation
or generic programming. While many people shy away from bit and byte fiddling
and instead prefer object-oriented concepts as the silver bullet to all
their problems, Chuck Allison stays very down to earth. His book is about
close-to-C and machine-level programming. It's not that he omits inheritance,
polymorphism, templates, or exception handling. All of the relevant C++
language features are discussed, even major parts of the standard library
are introduced.
However, this book's strength
is its coverage of the basic concepts that every C and C++ programmer should
thoroughly understand. Chuck spares us any esoteric topics. If you expect
to find any discussion of the latest ANSI standard features, you will be
disappointed. Date and time processing, for instance, are explained in
terms of the C locale rather than the C++ locales. Also, programming with
templates or exceptions is barely discussed. In contrast, the C library
is covered thoroughly, and basic concepts such as visibility and lifetime
of identifiers and objects are explained in a truly instructive and didactically
excellent way. In sum, system-level programmers will love this book; people
who love esoterica will prefer something else!
C&C++ Code Capsules
is organized into three three parts. The preliminaries discuss the "close
to C" part of C++: function-based programming, everything about pointers,
and comprehensive coverage of the standard C library. The key concepts
cover the typical C++ language features: classes, templates, exceptions,
and polymorphism, but also conversions and casts, a topic that is often
paid little attention to. Finally, the book discusses leveraging the standard
library. As the title says, this is about algorithms, containers, iterators
from the standard C++ library, but also about strings, both C- and C++-style
strings, file processing, time and date processing by means of the C library,
and memory management in C and C++.
The book excels at insightful
explanations of basic concepts. Highlights include its discussion of pointers,
about which you learn everything that you could possibly want to know,
starting with what a pointer is, how pointer arithmetics work (even including
a discussion of different storage schemes such as big-endian and little-endian),
to constness of pointers and categories of pointers (such as pointers to
arrays, to functions, to members functions), and more. In addition, the
discussion of integers and floats is excellent. Do you know how floating
point numbers are represented? Do you know what the constant DBL_MANT_DIG
means or what the "machine epsilon" is? If you want to do floating point
arithmetics, you should understand these concepts. Chuck gives a wonderful
introduction into issues related to numbers, not only their representation
but also integral promotions and demotions as well as arithmetic conversions
implicitly performed by the C++ compiler. Finally, bit manipulation. Chuck
is the father of the bit handling classes in the standard C++ library.
Naturally, he covers bit fiddling in all its hues and shades: bitwise operators,
bitmasks, bitsets, and bit strings.
So, what will this book buy
you? Let us quote the author himself: "Pointers gone awry are the nastiest
bugs a C++ programmer has to contend with. Indeed, pointers and the raw
power they give the developer have long been a popular criticism of C.
It's just too dangerous, people say." He closes his pointer chapter with
the statement that "C and C++ are only as dangerous as those who use them.
... If you understand these concepts, you are on your way to becoming a
responsible C++ programmer. Now go tell your boss she can trust you to
write real programs." It's a book for practitioners, indeed.
Angelika Langer
develops
and teaches classes on advanced C++, STL, multithreading, internationalization,
and Java. She has served on the ANSI/ISO C++ Committee since 1993.
Klaus
Kreft
is a software architect and consultant with more than a decade
of experience in industrial software development. He works for Siemens
Business Services in Germany. Langer and Kreft are working on a book about
standard C++ iostreams and locales and are columnists for
C++
Report
.
|