More Effective C++: 35 New Ways to Improve Your Programs and Designs (Paperback)

Scott Meyers

買這商品的人也買了...

商品描述

 

Table Of Contents

Acknowledgments.
Introduction.
Basics.

 

 

ITEM 1. Distinguish Between Pointers and References.
ITEM 2. Prefer C++-Style Casts.
ITEM 3. Never Treat Arrays Polymorphically.
ITEM 4. Avoid Gratuitous Default Constructors.


Operators.

 

 

ITEM 5. Be Wary of User-Defined Conversion Functions.
ITEM 6. Distinguish Between Prefix and Postfix Forms of Increment and decrement operators.
ITEM 7. Never Overload &&, ||, or,.
ITEM 8. Understand the Different Meanings of New and Delete.


Exceptions.

 

 

ITEM 9. Use Destructors to Prevent Resource Leaks.
ITEM 10. Prevent Resource Leaks in Constructors.
ITEM 11. Prevent Exceptions from Leaving Destructors.
ITEM 12. Understand How Throwing an Exception Differs from Passing a Parameter or Calling a Virtual Function.
ITEM 13. Catch Exceptions by Reference.
ITEM 14. Use Exception Specifications Judiciously.
ITEM 15. Understand the Costs of Exception Handling.


Efficiency.

 

 

ITEM 16. Remember the 80-20 Rule.
ITEM 17. Consider Using Lazy Evaluation.
ITEM 18. Amortize the Cost of Expected Computations.
ITEM 19. Understand the Origin of Temporary Objects.
ITEM 20. Facilitate the Return Value Optimization.
ITEM 21. Overload to Avoid Implicit Type Conversions.
ITEM 22. Consider Using Op= Instead of Stand-Alone Op.
ITEM 23. Consider Alternative Libraries.
ITEM 24. Understand the Costs of Virtual Functions, Multiple Inheritance, Virtual Base Classes, and RTTI.


Techniques.

 

 

ITEM 25. Virtualizing Constructors and Non-Member Functions.
ITEM 26. Limiting the Number of Objects of a Class.
ITEM 27. Requiring or Prohibiting Heap-Based Objects.
ITEM 28. Smart Pointers.
ITEM 29. Reference Counting.
ITEM 30. Proxy Classes.
ITEM 31. Making Functions Virtual With Respect to More Than One Object.


Miscellany.

 

 

ITEM 32. Program in the Future Tense.
ITEM 33. Make Non-Leaf Classes Abstract.
ITEM 34. Understand How to Combine C++ and C in the Same Program.
ITEM 35. Familiarize Yourself With the Language Standard.


Recommended Reading.
An Auto_Ptr Implementation.
General Index.
Index of Example Classes, Functions, and Templates. 020163371XT04062001


Back to Top