“The first edition of this book ranks among the small (very small) number of books
that I credit with significantly elevating my skills as a ‘professional’ software
developer. Like the others, it was practical and easy to read, but loaded with important
advice. Effective C++, Third Edition, continues that tradition. C++ is a very powerful
programming language. If C gives you enough rope to hang yourself, C++ is a
hardware store with lots of helpful people ready to tie knots for you. Mastering the points
discussed in this book will definitely increase your ability to effectively use C++ and
reduce your stress level.”
— Jack W. Reeves, Chief Executive Officer, Bleading Edge Software Technologies
Author(s): Scott Meyers
Edition: 3
Publisher: Addison-Wesley
Year: 2005
Language: English
Pages: 316
Tags: Библиотека;Компьютерная литература;C / C++;
Meyers S. Effective C++_55 Specific Ways to Improve Your Programs and Designs (ed.3) ......Page 5
Copyright ......Page 6
Contents ......Page 9
Preface\txv ......Page 12
Acknowledgments\txvii ......Page 14
Introduction l ......Page 18
Item 1: View C++ as a federation of languages. 11......Page 28
Item 2:\tPrefer consts, enums, and inlines to #defines.\t13......Page 30
Item 3:\tUse const whenever possible. 17......Page 34
Item 4:\tMake sure that objects are initialized before they’re used. 26......Page 43
Item 5:\tKnow what functions C++ silently writes and calls. 34......Page 51
Item 6:\tExplicitly disallow the use of compiler-generated functions you do not want. 37......Page 54
Item 7:\tDeclare destructors virtual in polymorphic base classes. 40......Page 57
Item 8:\tPrevent exceptions from leaving destructors. 44......Page 61
Item 9:\tNever call virtual functions during construction or destruction. 48......Page 65
Item 10:Have assignment operators return a reference to\t*this. 52......Page 69
Item 11:Handle assignment to self in operator=. 53......Page 70
Item 12:Copy all parts of an object. 57......Page 74
Item 13:Use objects to manage resources. 61......Page 78
Item 14:Think carefully about copying behavior in resource-managing classes. 66......Page 83
Item 15:Provide access to raw resources in resource-managing classes. 69......Page 86
Item 16: Use the same form in corresponding uses of new and delete. 73......Page 90
Item 17: Store newed objects in smart pointers in standalone statements. 75......Page 92
Item 18: Make interfaces easy to use correctly and hard to use incorrectly. 78......Page 95
Item 19: Treat class design as type design. 84......Page 101
Item 20: Prefer pass-by-reference-to-const to pass-by-value.\t86......Page 103
Item 21: Don’t try to return a reference when you must return an object. 90......Page 107
Item 22: Declare data members private. 94......Page 111
Item 23: Prefer non-member non-friend functions to member functions. 98......Page 115
Item 24: Declare non-member functions when type conversions should apply to all parameters. 102......Page 119
Item 25: Consider support for a non-throwing swap. 106......Page 123
Item 26: Postpone variable definitions as long as possible. 113......Page 130
Item 27: Minimizecasting.116......Page 133
Item 28: Avoid returning “handles” to object internals.123......Page 140
Item 29: Strive for exception-safe code. 127......Page 144
Item 30: Understand the ins and outs of inlining.134......Page 151
Item 31: Minimize compilation dependencies between files. 140......Page 157
Chapter 6: Inheritance and Object-Oriented Design 149......Page 166
Item 32: Make sure public inheritance models “is-a.” 150......Page 167
Item 33: Avoid hiding inherited names. 156......Page 173
Item 34: Differentiate between inheritance of interface and inheritance of implementation. 161......Page 178
Item 35: Consider alternatives to virtual functions. 169......Page 186
Item 36: Never redefine an inherited non-virtual function. 178......Page 195
Item 37: Never redefine a function’s inherited default parameter value. 180......Page 197
Item 38: Model “has-a” or “is-implemented-in-terms-of’ through composition. 184......Page 201
Item 39: Useprivateinheritancejudiciously. 187......Page 204
Item 40: Usemultipleinheritancejudiciously. 192......Page 209
Item 41: Understand implicit interfaces and compile-time polymorphism. 199......Page 216
Item 42: Understand the two meanings of typename. 203......Page 220
Item 43: Know how to access names in templatized base classes. 207......Page 224
Item 44: Factor parameter-independent code out of templates. 212......Page 229
Item 45: Use member function templates to accept “all compatible types. ” 218......Page 235
Item 46: Define non-member functions inside templates when type conversions are desired. 222......Page 239
Item 47: Use traits classes for information about types. 226......Page 243
Item 48: Be aware of template metaprogramming. 233......Page 250
Chapter 8: Customizing new and delete 239......Page 256
Item 49: Understand the behavior of the new-handler. 240......Page 257
Item 50: Understand when it makes sense to replace new and delete. 247......Page 264
Item 51: Adhere to convention when writing new and delete. 252......Page 269
Item 52: Write placement delete if you write placement new. 256......Page 273
Item 53: Pay attention to compiler warnings. 262......Page 279
Item 54: Familiarize yourself with the standard library,including TR1. 263......Page 280
Item 55: Familiarize yourself with Boost. 269......Page 286
Appendix A: Beyond Effective C++ 273......Page 290
Appendix B: Item Mappings Between Second and Third Editions\t277......Page 294
Index 280......Page 297
cover ......Page 1