| |
| |
Preface | |
| |
| |
Prologue | |
| |
| |
Imperfections, Constraints, Definitions, and Recommendations | |
| |
| |
| |
Fundamentals | |
| |
| |
| |
Enforcing Design: Constraints, Contracts, and Assertions | |
| |
| |
| |
Eggs and Ham | |
| |
| |
| |
Compile-Time Contracts: Constraints | |
| |
| |
| |
Runtime Contracts: Preconditions, Postconditions, and Invariants | |
| |
| |
| |
Assertions | |
| |
| |
| |
Object Lifetime | |
| |
| |
| |
The Object Life Cycle | |
| |
| |
| |
Controlling Your Clients | |
| |
| |
| |
MILs and Boon | |
| |
| |
| |
Resource Encapsulation | |
| |
| |
| |
A Taxonomy of Resource Encapsulation | |
| |
| |
| |
POD Types | |
| |
| |
| |
Wrapper Proxies | |
| |
| |
| |
RRID Types | |
| |
| |
| |
RAII Types | |
| |
| |
| |
RAII Coda | |
| |
| |
| |
Data Encapsulation and Value Types | |
| |
| |
| |
A Taxonomy of Data Encapsulation | |
| |
| |
| |
Value Types and Entity Types | |
| |
| |
| |
A Taxonomy of Value Types | |
| |
| |
| |
Open Types | |
| |
| |
| |
Encapsulated Types | |
| |
| |
| |
Value Types | |
| |
| |
| |
Arithmetic Value Types | |
| |
| |
| |
Value Types Coda | |
| |
| |
| |
Encapsulation Coda | |
| |
| |
| |
Object Access Models | |
| |
| |
| |
Vouched Lifetimes | |
| |
| |
| |
Copied for Caller | |
| |
| |
| |
Given to Caller | |
| |
| |
| |
Shared Objects | |
| |
| |
| |
Scoping Classes | |
| |
| |
| |
Value | |
| |
| |
| |
State | |
| |
| |
| |
APIs and Services | |
| |
| |
| |
Language Features | |
| |
| |
| |
Surviving the Real World | |
| |
| |
| |
ABI | |
| |
| |
| |
Sharing Code | |
| |
| |
| |
C ABI Requirements | |
| |
| |
| |
C++ ABI Requirements | |
| |
| |
| |
I Can C Clearly Now | |
| |
| |
| |
Objects Across Borders | |
| |
| |
| |
Mostly Portable vtables? | |
| |
| |
| |
Portable vtables | |
| |
| |
| |
ABI/OAB Coda | |
| |
| |
| |
Dynamic Libraries | |
| |
| |
| |
Calling Functions Explicitly | |
| |
| |
| |
Indentity: Link Units and Link Space | |
| |
| |
| |
Lifetime | |
| |
| |
| |
Versioning | |
| |
| |
| |
Resource Ownership | |
| |
| |
| |
Dynamic Libraries: Coda | |
| |
| |
| |
Threading | |
| |
| |
| |
Synchronizing Integer Access | |
| |
| |
| |
Synchronizing Block Access: Critical Regions | |
| |
| |
| |
Atomic Integer Performance | |
| |
| |
| |
Multithreading Extensions | |
| |
| |
| |
Thread Specific Storage | |
| |
| |
| |
Statics | |
| |
| |
| |
Nonlocal Static Objects: Globals | |
| |
| |
| |
Singletons | |
| |
| |
| |
Function-Local Static Objects | |
| |
| |
| |
Static Members | |
| |
| |
| |
Statics Coda | |
| |
| |
| |
Optimization | |
| |
| |
| |
Inline Functions | |
| |
| |
| |
Return Value Optimization | |
| |
| |
| |
Empty Base Optimization | |
| |
| |
| |
Empty Derived Optimization | |
| |
| |
| |
Preventing Optimization | |
| |
| |
| |
Language Concerns | |
| |
| |
| |
Fundamental Types | |
| |
| |
| |
May I Have a byte? | |
| |
| |
| |
Fixed-Sized Integer Types | |
| |
| |
| |
Large Integer Types | |
| |
| |
| |
Dangerous Types | |
| |
| |
| |
Arrays and Pointers | |
| |
| |
| |
Don't Repeat Yourself | |
| |
| |
| |
Arrays Decay into Pointers | |
| |
| |
| |
dimensionof() | |
| |
| |
| |
Cannot Pass Arrays to Functions | |
| |
| |
| |
Arrays Are Always Passed by Address | |
| |
| |
| |
Arrays of Inherited Types | |
| |
| |
| |
Cannot Have Multidimensional Arrays | |
| |
| |
| |
Values | |
| |
| |
| |
NULL-The Keyword That Wasn't | |
| |
| |
| |
Down to Zero | |
| |
| |
| |
Bending the Truth | |
| |
| |
| |
Literals | |
| |
| |
| |
Constants | |
| |
| |
| |
Keywords | |
| |
| |
| |
interface | |
| |
| |
| |
temporary | |
| |
| |
| |
owner | |
| |
| |
| |
explicit(_cast) | |
| |
| |
| |
unique | |
| |
| |
| |
final | |
| |
| |
| |
Unsupported Keywords | |
| |
| |
| |
Syntax | |
| |
| |
| |
Class Layout | |
| |
| |
| |
Conditional Expressions | |
| |
| |
| |
for | |
| |
| |
| |
Variable Notation | |
| |
| |
| |
Typedefs | |
| |
| |
| |
Pointer typedefs | |
| |
| |
| |
What's in a Definition? | |
| |
| |
| |
Aliases | |
| |
| |
| |
True Typedefs | |
| |
| |
| |
The Good, the Bad, and the Ugly | |
| |
| |
| |
Cognizant Conversions | |
| |
| |
| |
Casts | |
| |
| |
| |
Implicit Conversion | |
| |
| |
| |
Casting in C++ | |
| |
| |
| |
The Case for C Casts | |
| |
| |
| |
Casts on Steroids | |
| |
| |
| |
explicit_cast | |
| |
| |
| |
literal_cast | |
| |
| |
| |
union_cast | |
| |
| |
| |
comstl::interface_cast | |
| |
| |
| |
boost::polymorphic_cast | |
| |
| |
| |
Casts: Coda | |
| |
| |
| |
Shims | |
| |
| |
| |
Embracing Change and Enhancing Flexibility | |
| |
| |
| |
Attribute Shims | |
| |
| |
| |
Logical Shims | |
| |
| |
| |
Control Shims | |
| |
| |
| |
Conversion Shims | |
| |
| |
| |
Composite Shim Concepts | |
| |
| |
| |
Namespaces and Koenig Lookup | |
| |
| |
| |
Why Not Traits? | |
| |
| |
| |
Structural Conformance | |
| |
| |
| |
Breaking Up the Monolith | |
| |
| |
| |
Shims: Coda | |
| |
| |
| |
Veneers | |
| |
| |
| |
Lightweight RAII | |
| |
| |
| |
Binding Data and Operations | |
| |
| |
| |
Rubbing Up to Concepts | |
| |
| |
| |
Veneers: Coda | |
| |
| |
| |
Bolt-ins | |
| |
| |
| |
Adding Functionality | |
| |
| |
| |
Skin Selection | |
| |
| |
| |
Nonvirtual Overriding | |
| |
| |
| |
Leveraging Scope | |
| |
| |
| |
Simulated Compile-Time Polymorphism: Reverse Bolt-ins | |
| |
| |
| |
Parameterized Polymorphic Packaging | |
| |
| |
| |
Bolt-ins: Coda | |
| |
| |
| |
Template Constructors | |
| |
| |
| |
Hidden Costs | |
| |
| |
| |
Dangling References | |
| |
| |
| |
Template Constructor Specialization | |
| |
| |
| |
Argument Proxies | |
| |
| |
| |
Argument Targeting | |
| |
| |
| |
Template Constructors: Coda | |
| |
| |
| |
Operators | |
| |
| |
| |
operator bool() | |
| |
| |
| |
operator int() const | |
| |
| |
| |
operator void *() const | |
| |
| |
| |
operator bool() const | |
| |
| |
| |
operator !()-not! | |
| |
| |
| |
operator boolean const *() const | |
| |
| |
| |
operator int boolean::*() const | |
| |
| |
| |
Operating in the Real World | |
| |
| |
| |
operator! | |
| |
| |
| |
Fast, Non-intrusive String Concatenation | |
| |
| |
| |
fast_string_concatenator<> | |
| |
| |
| |
Performance | |
| |
| |
| |
Working with Other String Classes | |
| |
| |
| |
Concatenation Seeding | |
| |
| |
| |
Pathological Bracing | |
| |
| |
| |
Standardization | |
| |
| |
| |
What's Your Address? | |
| |
| |
| |
Can't Get the Real Address | |
| |
| |
| |
What Actions Are Carried Out during Conversion? | |
| |
| |
| |
What Do We Return? | |
| |
| |
| |
What's Your Address: Coda | |
| |
| |
| |
Subscript Operators | |
| |
| |
| |
Pointer Conversion versus Subscript Operators | |
| |
| |
| |
Handling Errors | |
| |
| |
| |
Return Value | |
| |
| |
| |
Increment Operators | |
| |
| |
| |
Missing Postfix Operators | |
| |
| |
| |
Efficiency | |
| |
| |
| |
Arithmetic Types | |
| |
| |
| |
Class Definition | |
| |
| |
| |
Default Construction | |
| |
| |
| |
Initialization (Value Construction) | |
| |
| |
| |
Copy Construction | |
| |
| |
| |
Assignment | |
| |
| |
| |
Arithmetic Operators | |
| |
| |
| |
Comparison Operators | |
| |
| |
| |
Accessing the Value | |
| |
| |
| |
sinteger64 | |
| |
| |
| |
Truncations, Promotions, and Tests | |
| |
| |
| |
Arithmetic Types: Coda | |
| |
| |
| |
Short-circuit! | |
| |
| |
| |
Extending C++ | |
| |
| |
| |
Return Value Lifetime | |
| |
| |
| |
A Taxonomy of Return Value Lifetime Gotchas | |
| |
| |
| |
Why Return-by-Reference? | |
| |
| |
| |
Solution 1-integer_to_string<> | |
| |
| |
| |
Solution 2-TSS | |
| |
| |
| |
Solution 3-Extending RVL | |
| |
| |
| |
Solution 4-Static Array Size Determination | |
| |
| |
| |
Solution 5-Conversion Shims | |
| |
| |
| |
Performance | |
| |
| |
| |
RVL: The Big Win for Garbage Collection | |
| |
| |
| |
Potential Applications | |
| |
| |
| |
Return Value Lifetime: Coda | |
| |
| |
| |
Memory | |
| |
| |
| |
A Taxonomy of Memory | |
| |
| |
| |
The Best of Both Worlds | |
| |
| |
| |
Allocators | |
| |
| |
| |
Memory: Coda | |
| |
| |
| |
Multidimensional Arrays | |
| |
| |
| |
Facilitating Subscript Syntax | |
| |
| |
| |
Sized at Run Time | |
| |
| |
| |
Sized at Compile Time | |
| |
| |
| |
Block Access | |
| |
| |
| |
Performance | |
| |
| |
| |
Multidimensional Arrays: Coda | |
| |
| |
| |
Functors and Ranges | |
| |
| |
| |
Syntactic Clutter | |
| |
| |
| |
for_all()? | |
| |
| |
| |
Local Functors | |
| |
| |
| |
Ranges | |
| |
| |
| |
Functors and Ranges: Coda | |
| |
| |
| |
Properties | |
| |
| |
| |
Compiler Extension | |
| |
| |
| |
Implementation Options | |
| |
| |
| |
Field Properties | |
| |
| |
| |
Method Properties | |
| |
| |
| |
Static Properties | |
| |
| |
| |
Virtual Properties | |
| |
| |
| |
Property Uses | |
| |
| |
| |
Properties: Coda | |
| |
| |
| |
Compilers and Libraries | |
| |
| |
| |
Compilers | |
| |
| |
| |
Libraries | |
| |
| |
| |
Other Resources | |
| |
| |
| |
"Watch That Hubris!" | |
| |
| |
| |
Operator Overload | |
| |
| |
| |
DRY Rued Yesterday | |
| |
| |
| |
Paranoid Programming | |
| |
| |
| |
To Insanity, and Beyond! | |
| |
| |
| |
Arturius | |
| |
| |
| |
The CD | |
| |
| |
Epilogue | |
| |
| |
Bibliography | |
| |
| |
Index | |