1.3. C++ Standard Library
C++ programs consist of pieces
called classes and functions. You can
program each piece that you may need to form a C++ program. However, most C++
programmers take advantage of the rich collections of existing classes and
functions in the C++ Standard Library. Thus, there are really two parts to learning the C++
"world." The first is learning the C++ language itself; the second is learning
how to use the classes and functions in the C++ Standard Library. Throughout the
book, we discuss many of these classes and functions. P. J. Plauger's book,
The Standard C Library (Upper Saddle River, NJ: Prentice Hall PTR, 1992), is a must
read for programmers who need a deep understanding of the ANSI C library
functions that are included in C++, how to implement them and how to use them to
write portable code. The standard class libraries generally are provided by
compiler vendors. Many special-purpose class libraries are supplied by
independent software vendors.
Software Engineering Observation 1.1
|
When
programming in C++, you typically will use the following building blocks:
classes and functions from the C++ Standard Library, classes and functions you
and your colleagues create and classes and functions from various popular
third-party libraries. |
We include many Software
Engineering Observations throughout the book to
explain concepts that affect and improve the overall architecture and quality of
software systems. We also highlight other kinds of tips, including Good Programming Practices
(to help you write programs that are clearer, more understandable, more
maintainable and easier to test and debug—or remove programming errors), Common Programming Errors (problems to watch out
for and avoid), Performance Tips
(techniques for writing programs that run faster and use less memory), Portability Tips
(techniques to help you write programs that can run, with little or no
modification, on a variety of computers—these tips also include general
observations about how C++ achieves its high degree of portability) and Error-Prevention Tips
(techniques for removing programming errors—also known as bugs—from your
programs and, more important, techniques for writing bug-free programs in the
first place).
Performance Tip 1.1
|
Using C++
Standard Library functions and classes instead of writing your own versions can
improve program performance, because they are written carefully to perform
efficiently. This technique also shortens program development
time. |
Portability Tip 1.1
|
Using C++
Standard Library functions and classes instead of writing your own improves
program portability, because they are included in every C++
implementation. |