Register your product to gain access to bonus material or receive a coupon.
This book shares the hard-won wisdom of a highly-successful C++/C programmer - along with a large collection of ANSI-compliant programs that illustrate the true power of C++.KEY TOPICS:This book includes a wide variety of ideas, tips and techniques for programmers of all skill levels. It presents little-known facts about pointers and the preprocessor that are a must for the professional developer. It offers tips and techniques for more effective use of abstraction, templates, bit manipulation, visibility, control structures and exceptions. The book also shows how to make the most of the Standard C and Standard C++ libraries, covering containers and iterators; algorithms; text and file processing; time and date processing; and memory management.MARKET:For C++ and C professional developers, consultants, faculty and students of all skill levels.
Foreword, Bruce Eckel.
Preface.
C++: The Making of a Standard. An Interview with Bjarne Stroustrup.
I. Preliminaries.
1. A Better C.A Tale Of Two Languages. Incremental Journey. The Type System. Function Prototypes. Type-safe Linkage. References. Type-safe I/O. Standard Streams. Formatting. Manipulators. Function Overloading and Function Templates. Operator Overloading. Inline Functions. Default Arguments. new and delete. Statement Declarations. Standard Library Features. C Compatibility. Summary.
2. Pointers.Programming on the Edge. The Basics. Pointer Arithmetic. Pass-By-Reference Semantics. Generic Pointers. const Pointers. Pointers and One-Dimensional Arrays. Arrays as Parameters. Arrays of Strings. Pointers and Multidimensional Arrays. Higher and Deeper. Pointers to Functions. Pointers to Member Functions. Encapsulation and Incomplete Types. Summary.
3. The Preprocessor.The #include Directive. Other Preprocessor Directives. Predefined Macros. Conditional Compilation. Preprocessing Operators. Implementing assert. Macro Magic. Character Sets, Trigraphs, and Digraphs. Phases of Translation. Summary.
4. The Standard C Library, Part I.For the Adequate Programmer. <ctype.h>. <stdio.h>. <stdlib.h>. <string.h>.
5. The Standard C Library, Part II.For the Polished Programmer. <assert.h>. <limits.h>. <stddef.h>. <time.h>. Appendix 5.1: Character Sets. Code Pages. Character Set Standards. ISO 10646. Unicode.
6. The Standard C Library, Part III.For the Complete Programmer. <float.h>. <math.h>. <errno.h>. <locale.h>. <setjmp.h>. <signal.h>. <stdarg.h>. va_list's As Arguments. An Application. Conclusion. Appendix 6.1: Floating-point Number Systems.
II. Key Concepts.
7. Abstraction.Data Abstraction. Operator Overloading. Concrete Data Types. Type Abstraction. Function Abstraction. Summary.
8. Templates.Generic Programming. Function Templates. Class Templates. Template Parameters. Template Specialization. Summary.
9. Bit Manipulation.Bitwise Operators. Accessing Individual Bits. Large Bitsets. Bit Strings. Wish List. The bitset Template. The vector<bool> Template Specialization. Summary.
10. Conversions and Casts.Integral Promotion. Demotions. Arithmetic Conversions. Function Prototypes. Explicit Conversions. Function-style Casts. Const Correctness. User-Defined Conversions. Beefing up operator[]. New-Style Casts. Summary.
11. Visibility.What's In a Name? Scope. Minimal Scoping. Class Scope. Nested Classes. Local Classes. Classic Namespaces. Namespace Scope. Lifetime. Lifetime of Temporaries. Linkage. Type-safe Linkage. "Language" Linkage. Summary.
12. Control Structures.Structured Programming. Branching. Nonlocal Branching. Signals. Summary. References.
13. Exceptions.Error Handling Alternatives. Stack Unwinding. Catching Exceptions. Standard Exceptions. Resource Management. Constructors and Exceptions. Memory Management. Exception Specifications. An Error-Handling Strategy. Summary.
14. Object-oriented Programming.Inheritance. Heterogeneous Collections. Virtual Functions and Polymorphism. Abstract Base Classes. Case Study: A Framework for Object Persistence. Database Access. Mapping Objects to Relational Schema. PFX Architecture. A Code Walkthrough. Summary.
III. Leveraging the Standard Library.
15. Algorithms.Complexity. Generic Algorithms. Function Objects. Function Taxonomy. Function Object Adapters. Algorithm Taxonomy. Summary. References.
16. Containers and Iterators.Standard Containers. Iterators. Iterator Taxonomy. Special-Purpose Iterators. Container Adapters. Associative Containers. Applications. Non-STL Containers. Summary.
17. Text Processing.scanf. printf. Substrings. The Standard C++ String Class. String Streams. Wide Strings. Summary.
18. File Processing.Filters. Binary Files. Record Processing. Temporary Files. Portability. POSIX. File Descriptors. Copying Files via Descriptors. Reading Directory Entries. Redirecting Standard Error. Encapsulating Directory Operations. Summary.
19. Time and Date Processing.Julian Day Encoding. Date Classes for Real Work. Calculating the Week of the Year. Summary. Reference.
20. Dynamic Memory Management.Ragged Arrays. Using the Heap in Standard C. The C++ Free Store. Deep versus Shallow Copy. Handling Memory Allocation Failure. Overriding new and delete. Placement new. Managing the Heap. Avoiding Memory Management. Summary.
Appendices.
A. C/C++ Compatibility.Function Objects. Function Object Adapters.
D Annotated Bibliography.The C Practitioner's Booklist. The C++ Practitioner's Booklist.
Index.This book is for people who program in C and C++ for a living. It assumes that you are already familiar with the syntax and basic constructs of both languages, and it offers practical wisdom for creating effective, real-world programs. Each code capsule, or sample program, contains working code illustrating proven idioms and techniques that leverage the power of these important programming languages.
This book serves as a voice of experience for those who wish to strengthen their skills and improve their effectiveness in the workplace. Despite current fervor for the object-oriented paradigm (which this book abundantly embraces), I make no excuse for paying homage to the C foundations of C++. I have found too many developers ill-prepared to master C++ because they lack a thorough understanding of basic concepts such as pointers, scope, linkage, and static type checking. Perhaps the biggest deficiency of all is a lack of familiarity with the standard C library. It is sad indeed when developers waste time reinventing what the library functions already provide so well. The C++ novice is often too eager to abandon (i.e., gloss over) simple C in favor of the "exciting" features of C++, such as inheritance, exceptions, or overriding operator new, even when such are not warranted. I feel confident that everyone will learn something from these pages.
The first chapter (Chapter 0), an excerpt from an interview I conducted with Bjarne Stroustrup, records his feelings about the state of C++ as it becomes a standard. The rest of the book is divided into three parts.
Part I: Preliminaries
After a brief tour of C++, these chapters close some of the gaps a typical C programmer might have before s/he prepares to tackle C++.
In summary, this is book about what works. I've attempted to steer the reader away from the "gotchas" by illustrating "best practices" with a reasonable balance of breadth and depth. Why another C++ book in 1998? Because the language and library haven't stabilized until now. This book goes to press just one week after the standards committee met to approve the final draft of ISO C++, and I have taken care to steer clear of any dark corners that remain (all languages and environment have them). I am confident that all the material in this book will be timely for years to come.
Chuck Allison
http://www.freshsources.com
November 1997