Cover image for The C++ programming language
The C++ programming language
Stroustrup, Bjarne.
Personal Author:
Special edition.
Publication Information:
Reading, Mass. : Addison-Wesley, [2000]

Physical Description:
x, 1019 pages : illustrations ; 25 cm
General Note:
Includes index.

Format :


Call Number
Material Type
Home Location
Item Holds
QA76.73.C153 S77 2000 Adult Non-Fiction Central Closed Stacks

On Order



More than three-quarters of a million programmers have benefited from this book in all of its editions

Written by Bjarne Stroustrup, the creator of C++, this is the world's most trusted and widely read book on C++.

For this special hardcover edition, two new appendixes on locales and standard library exception safety (also available at ) have been added. The result is complete, authoritative coverage of the C++ language, its standard library, and key design techniques. Based on the ANSI/ISO C++ standard, The C++ Programming Language provides current and comprehensive coverage of all C++ language features and standard library components.

For example: abstract classes as interfaces class hierarchies for object-oriented programming templates as the basis for type-safe generic software exceptions for regular error handling namespaces for modularity in large-scale software run-time type identification for loosely coupled systems the C subset of C++ for C compatibility and system-level work standard containers and algorithms standard strings, I/O streams, and numerics C compatibility, internationalization, and exception safety Bjarne Stroustrup makes C++ even more accessible to those new to the language, while adding advanced information and techniques that even expert C++ programmers will find invaluable.

Author Notes

Bjarne Stroustrup is the designer and original implementor of C++ A graduate of the University of Aarhus, Denmark, and Cambridge University, England, Dr. Stroustrup is currently the head of ATandT Labs' Large-Scale Programming Research Department, an ATandT Fellow, an ATandT Bell Laboratories Fellow, and an ACM fellow.



Programming is understanding. -- Kristen Nygaard I find using C++ more enjoyable than ever. C++'s support for design and programming has improved dramatically over the years, and lots of new helpful techniques have been developed for its use. However, C++ is not just fun. Ordinary practical programmers have achieved significant improvements in productivity, maintainability, flexibility, and quality in projects of just about any kind and scale. By now, C++ has fulfilled most of the hopes I originally had for it, and also succeeded at tasks I hadn't even dreamt of. This book introduces standard C++* and the key programming and design techniques supported by C++. Standard C++ is a far more powerful and polished language than the version of C++ introduced by the first edition of this book. New language features such as name spaces, exceptions, templates, and run-time type identification allow many techniques to be applied more directly than was possible before, and the standard library allows the programmer to start from a much higher level than the bare language. About a third of the information in the second edition of this book came from the first. This third edition is the result of a rewrite of even larger magnitude. It offers something to even the most experienced C++ programmer; at the same time, this book is easier for the novice to approach that its predecessors were. The explosion of C++ use and the massive amount of experience accumulated as a result makes this possible. The definition of an extensive standard library makes a difference to the way C++ concepts can be presented. As before, this book presents C++ independently of any particular implementation, and as before, the tutorial chapters present language constructs and concepts in a "bottom up" order so that a construct is used only after it has been defined. However, it is much easier to use a well-designed library than it is to understand the details of its implementation. Therefore the standard library can be used to provide realistic and interesting examples well before a reader can be assumed to understand its inner workings. the standard library itself is also a fertile source of programming examples and design techniques. This book presents every major C++ language feature and the standard library. It is organized around language and library facilities. However, features are presented in the context of their use. That is, the focus is on the language as the tool for design and programming rather than on the language in itself. This book demonstrates key techniques that make C++ effective and teaches the fundamental concepts necessary for mastery. Except where illustrating technicalities, examples are taken from the domain of systems software. A companion, The Annotated C++ Language Standard, presents the complete language definition together with annotations to make it more comprehensible. The primary aim of this book is to help the reader understand how the facilities offered by C++ support key programming techniques. The aim is to take the reader far beyond the point where he or she gets code running primarily by copying examples and emulation programming styles from other languages. Only a good understanding of the ideas behind the language facilities leads to mastery. Supplemented by implementation documentation, the information provided is sufficient for completing significant real-world projects. The hope is that this book will help the reader gain new insights and become a better programmer and designer. Acknowledgments In addition to the people mentioned in the acknowledgment section of the first and second editions, I would like to thank Matt Austern, Hans Boehm, Don Caldwell, Lawrence Crowl, Alan Feuer, Andrew Forrest, Tim Griffin, Peter Juhl, Brian Kernighan, Andrew Koenig, Mike Mowbray, Rob Murray, Lee Nackman, Joseph Newcomer, Alex Stepanov, David Vandevoorde, Peter Weinberger, and Chris Van Wyk for commenting on draft chapters of this third edition. I would also like to thank the volunteers on the C++ standards committees who did an immense amount of constructive work to make C++ what it is today. It is slightly unfair to single out individuals, but it would be even more unfair not to mention anyone, so I'd like to especially mention Mike Ball, Dag Brueck, Sean Corfield, Ted Goldstein, Kim Knutilla, Andrew Koenig, Josee Lajoie, Dmitry Lenkov, Nathan Myers, Martin O'Riordan, Tom Plum, Jonathan Shopiro, John Spicer, Jerry Schwarz, Alex Stepanov, and Mike Vilot, as people who each directly cooperated with me over some part of C++ and its standard library. After the initial printing of this book, many dozens of people have mailed me corrections and suggestions for improvements. I have been able to accommodate many of their suggestions within the framework of the book so that later printings benefitted significantly. Translators of this book into many languages have also provided many clarifications. In response to requests from readers, I have added appendices D and E. Let me take this opportunity to thank a few of those who helped: Dave Abrahams, Matt Austern, Jan Bielawski, Janina Mincer Daszkiewicz, Andrew Koenig, Dietmar Kuehl, Nicolai Josuttis, Nathan Myers, Paul E. Sevinc, Andy Tenne-Sens, Shoichi Uchida, Ping-Fai (Mike) Yang, and Dennis Yelle. Bjarne Stroustrup Murray Hill, New Jersey 0201700735P04062001 Excerpted from The C++ Programming Language by Bjarne Stroustrup All rights reserved by the original copyright owners. Excerpts are provided for display purposes only and may not be reproduced, reprinted or distributed without the written permission of the publisher.

Table of Contents

Prefacep. v
Preface to Second Editionp. vii
Preface to First Editionp. ix
Introductory Materialp. 1
1 Notes to the Readerp. 3
2 A Tour of C++p. 21
3 A Tour of the Standard Libraryp. 45
Part I Basic Facilitiesp. 67
4 Types and Declarationsp. 69
5 Pointers, Arrays, and Structuresp. 87
6 Expressions and Statementsp. 107
7 Functionsp. 143
8 Namespaces and Exceptionsp. 165
9 Source Files and Programsp. 197
Part II Abstraction Mechanismsp. 221
10 Classesp. 223
11 Operator Overloadingp. 261
12 Derived Classesp. 301
13 Templatesp. 327
14 Exception Handlingp. 355
15 Class Hierarchiesp. 389
Part III The Standard Libraryp. 427
16 Library Organization and Containersp. 429
17 Standard Containersp. 461
18 Algorithms and Function Objectsp. 507
19 Iterators and Allocatorsp. 549
20 Stringsp. 579
21 Streamsp. 605
22 Numericsp. 657
Part IV Design Using C++p. 689
23 Development and Designp. 691
24 Design and Programmingp. 723
25 Roles of Classesp. 765
Appendicesp. 791
A The C++ Grammarp. 793
B Compatibilityp. 815
C Technicalitiesp. 827
D Localesp. 869
E Standard Library Exception Safetyp. 935
Indexp. 969