• Table of Contents
• Examples
Imperfect C++ Practical Solutions for Real-Life Programming
By Matthew Wilson
 
Publisher: Addison Wesley Professional
Pub Date: October 21, 2004
ISBN: 0-321-22877-4
Pages: 624
Slots: 1.0 


   Copyright
   Preface
     What You Will Learn
     What I Assume You Know
     Organization
     References
     Supplementary Material
     Acknowledgments
   Prologue: Philosophy of the Imperfect Practitioner
     C++ Is Not Perfect
     Hairshirt Programming
     Making the Compiler Your Batman
     Never Say Die
     The Spirit of Imperfect C++
     Coding Style
     Terminology
   Imperfections, Constraints, Definitions, and Recommendations
   Part One.  Fundamentals
       Chapter 1.  Enforcing Design: Constraints, Contracts, and Assertions
     Section 1.1.  Eggs and Ham
     Section 1.2.  Compile-Time Contracts: Constraints
     Section 1.3.  Runtime Contracts: Preconditions, Postconditions, and Invariants
     Section 1.4.  Assertions
       Chapter 2.  Object Lifetime
     Section 2.1.  The Object Life Cycle
     Section 2.2.  Controlling Your Clients
     Section 2.3.  MILs and Boon
       Chapter 3.  Resource Encapsulation
     Section 3.1.  A Taxonomy of Resource Encapsulation
     Section 3.2.  POD Types
     Section 3.3.  Wrapper Proxies
     Section 3.4.  RRID Types
     Section 3.5.  RAII Types
     Section 3.6.  RAII Coda
       Chapter 4.  Data Encapsulation and Value Types
     Section 4.1.  A Taxonomy of Data Encapsulation
     Section 4.2.  Value Types and Entity Types
     Section 4.3.  A Taxonomy of Value Types
     Section 4.4.  Open Types
     Section 4.5.  Encapsulated Types
     Section 4.6.  Value Types
     Section 4.7.  Arithmetic Value Types
     Section 4.8.  Value Types Coda
     Section 4.9.  Encapsulation Coda
       Chapter 5.  Object Access Models
     Section 5.1.  Vouched Lifetimes
     Section 5.2.  Copied for Caller
     Section 5.3.  Given to Caller
     Section 5.4.  Shared Objects
       Chapter 6.  Scoping Classes
     Section 6.1.  Value
     Section 6.2.  State
     Section 6.3.  APIs and Services
     Section 6.4.  Language Features
   Part Two.  Surviving the Real World
       Chapter 7.  ABI
     Section 7.1.  Sharing Code
     Section 7.2.  C ABI Requirements
     Section 7.3.  C++ ABI Requirements
     Section 7.4.  I Can C Clearly Now
       Chapter 8.  Objects Across Borders
     Section 8.1.  Mostly Portable vtables?
     Section 8.2.  Portable vtables
     Section 8.3.  ABI/OAB Coda
       Chapter 9.  Dynamic Libraries
     Section 9.1.  Calling Functions Explicitly
     Section 9.2.  Indentity: Link Units and Link Space
     Section 9.3.  Lifetime
     Section 9.4.  Versioning
     Section 9.5.  Resource Ownership
     Section 9.6.  Dynamic Libraries: Coda
       Chapter 10.  Threading
     Section 10.1.  Synchronizing Integer Access
     Section 10.2.  Synchronizing Block Access: Critical Regions
     Section 10.3.  Atomic Integer Performance
     Section 10.4.  Multithreading Extensions
     Section 10.5.  Thread Specific Storage
       Chapter 11.  Statics
     Section 11.1.  Nonlocal Static Objects: Globals
     Section 11.2.  Singletons
     Section 11.3.  Function-Local Static Objects
     Section 11.4.  Static Members
     Section 11.5.  Statics Coda
       Chapter 12.  Optimization
     Section 12.1.  Inline Functions
     Section 12.2.  Return Value Optimization
     Section 12.3.  Empty Base Optimization
     Section 12.4.  Empty Derived Optimization
     Section 12.5.  Preventing Optimization
   Part Three.  Language Concerns
       Chapter 13.  Fundamental Types
     Section 13.1.  May I Have a byte?
     Section 13.2.  Fixed-Sized Integer Types
     Section 13.3.  Large Integer Types
     Section 13.4.  Dangerous Types
       Chapter 14.  Arrays and Pointers
     Section 14.1.  Don't Repeat Yourself
     Section 14.2.  Arrays Decay into Pointers
     Section 14.3.  dimensionof()
     Section 14.4.  Cannot Pass Arrays to Functions
     Section 14.5.  Arrays Are Always Passed by Address
     Section 14.6.  Arrays of Inherited Types
     Section 14.7.  Cannot Have Multidimensional Arrays
       Chapter 15.  Values
     Section 15.1.  NULLThe Keyword That Wasn't
     Section 15.2.  Down to Zero
     Section 15.3.  Bending the Truth
     Section 15.4.  Literals
     Section 15.5.  Constants
       Chapter 16.  Keywords
     Section 16.1.  interface
     Section 16.2.  temporary
     Section 16.3.  owner
     Section 16.4.  explicit(_cast)
     Section 16.5.  unique
     Section 16.6.  final
     Section 16.7.  Unsupported Keywords
       Chapter 17.  Syntax
     Section 17.1.  Class Layout
     Section 17.2.  Conditional Expressions
     Section 17.3.  for
     Section 17.4.  Variable Notation
       Chapter 18.  Typedefs
     Section 18.1.  Pointer Typedefs
     Section 18.2.  What's in a Definition?
     Section 18.3.  Aliases
     Section 18.4.  True Typedefs
     Section 18.5.  The Good, the Bad, and the Ugly
   Part Four.  Cognizant Conversions
       Chapter 19.  Casts
     Section 19.1.  Implicit Conversion
     Section 19.2.  Casting in C++
     Section 19.3.  The Case for C Casts
     Section 19.4.  Casts on Steroids
     Section 19.5.  explicit_cast
     Section 19.6.  literal_cast
     Section 19.7.  union_cast
     Section 19.8.  comstl::interface_cast
     Section 19.9.  boost::polymorphic_cast
     Section 19.10.  Casts: Coda
       Chapter 20.  Shims
     Section 20.1.  Embracing Change and Enhancing Flexibility
     Section 20.2.  Attribute Shims
     Section 20.3.  Logical Shims
     Section 20.4.  Control Shims
     Section 20.5.  Conversion Shims
     Section 20.6.  Composite Shim Concepts
     Section 20.7.  Namespaces and Koenig Lookup
     Section 20.8.  Why Not Traits?
     Section 20.9.  Structural Conformance
     Section 20.10.  Breaking Up the Monolith
     Section 20.11.  Shims: Coda
       Chapter 21.  Veneers
     Section 21.1.  Lightweight RAII
     Section 21.2.  Binding Data and Operations
     Section 21.3.  Rubbing Up to Concepts
     Section 21.4.  Veneers: Coda
       Chapter 22.  Bolt-ins
     Section 22.1.  Adding Functionality
     Section 22.2.  Skin Selection
     Section 22.3.  Nonvirtual Overriding
     Section 22.4.  Leveraging Scope
     Section 22.5.  Simulated Compile-Time Polymorphism: Reverse Bolt-ins
     Section 22.6.  Parameterized Polymorphic Packaging
     Section 22.7.  Bolt-ins: Coda
       Chapter 23.  Template Constructors
     Section 23.1.  Hidden Costs
     Section 23.2.  Dangling References
     Section 23.3.  Template Constructor Specialization
     Section 23.4.  Argument Proxies
     Section 23.5.  Argument Targeting
     Section 23.6.  Template Constructors: Coda
   Part Five.  Operators
       Chapter 24.  operator bool()
     Section 24.1.  operator int() const
     Section 24.2.  operator void *() const
     Section 24.3.  operator bool() const
     Section 24.4.  operator !()not!
     Section 24.5.  operator boolean const *() const
     Section 24.6.  operator int boolean::*() const
     Section 24.7.  Operating in the Real World
     Section 24.8.  operator!
       Chapter 25.  Fast, Non-intrusive String Concatenation
     Section 25.1.  fast_string_concatenator<>
     Section 25.2.  Performance
     Section 25.3.  Working with Other String Classes
     Section 25.4.  Concatenation Seeding
     Section 25.5.  Pathological Bracing
     Section 25.6.  Standardization
       Chapter 26.  What's Your Address?
     Section 26.1.  Can't Get the Real Address
     Section 26.2.  What Actions Are Carried Out during Conversion?
     Section 26.3.  What Do We Return?
     Section 26.4.  What's Your Address: Coda
       Chapter 27.  Subscript Operators
     Section 27.1.  Pointer Conversion versus Subscript Operators
     Section 27.2.  Handling Errors
     Section 27.3.  Return Value
       Chapter 28.  Increment Operators
     Section 28.1.  Missing Postfix Operators
     Section 28.2.  Efficiency
       Chapter 29.  Arithmetic Types
     Section 29.1.  Class Definition
     Section 29.2.  Default Construction
     Section 29.3.  Initialization (Value Construction)
     Section 29.4.  Copy Construction
     Section 29.5.  Assignment
     Section 29.6.  Arithmetic Operators
     Section 29.7.  Comparison Operators
     Section 29.8.  Accessing the Value
     Section 29.9.  sinteger64
     Section 29.10.  Truncations, Promotions, and Tests
     Section 29.11.  Arithmetic Types: Coda
       Chapter 30.  Short-circuit!
   Part Six.  Extending C++
       Chapter 31.  Return Value Lifetime
     Section 31.1.  A Taxonomy of Return Value Lifetime Gotchas
     Section 31.2.  Why Return-by-Reference?
     Section 31.3.  Solution 1integer_to_string<>
     Section 31.4.  Solution 2TSS
     Section 31.5.  Solution 3Extending RVL
     Section 31.6.  Solution 4Static Array Size Determination
     Section 31.7.  Solution 5Conversion Shims
     Section 31.8.  Performance
     Section 31.9.  RVL: The Big Win for Garbage Collection
     Section 31.10.  Potential Applications
     Section 31.11.  Return Value Lifetime: Coda
       Chapter 32.  Memory
     Section 32.1.  A Taxonomy of Memory
     Section 32.2.  The Best of Both Worlds
     Section 32.3.  Allocators
     Section 32.4.  Memory: Coda
       Chapter 33.  Multidimensional Arrays
     Section 33.1.  Facilitating Subscript Syntax
     Section 33.2.  Sized at Run Time
     Section 33.3.  Sized at Compile Time
     Section 33.4.  Block Access
     Section 33.5.  Performance
     Section 33.6.  Multidimensional Arrays: Coda
       Chapter 34.  Functors and Ranges
     Section 34.1.  Syntactic Clutter
     Section 34.2.  for_all() ?
     Section 34.3.  Local Functors
     Section 34.4.  Ranges
     Section 34.5.  Functors and Ranges: Coda
       Chapter 35.  Properties
     Section 35.1.  Compiler Extensions
     Section 35.2.  Implementation Options
     Section 35.3.  Field Properties
     Section 35.4.  Method Properties
     Section 35.5.  Static Properties
     Section 35.6.  Virtual Properties
     Section 35.7.  Property Uses
     Section 35.8.  Properties: Coda
      Appendix A.  Compilers and Libraries
     Section A.1.  Compilers
     Section A.2.  Libraries
     Section A.3.  Other Resources
      Appendix B.  "Watch That Hubris!"
     Section B.1.  Operator Overload
     Section B.2.  DRY Rued Yesterday
     Section B.3.  Paranoid Programming
     Section B.4.  To Insanity, and Beyond!
      Appendix C.  Arturius
      Appendix D.  The CD
      Epilogue
      Bibliography
   Index