
Effective C++
50 Specific Ways to Improve Your Programs and Design
Scott Meyers(Author)
Addison Wesley (Publisher)
2nd Edition
Published on 9. October 1997
Book
Paperback/Softback
288 pages
978-0-201-92488-6 (ISBN)
Article exhausted; check for reprint
Description
The first edition of Effective C++ sold nearly 100,000 copies and was translated into four languages. It's easy to understand why. Scott Meyers' practical approach to C++ described the rules of thumb employed by the experts-the things they almost always do or almost always avoid doing-to produce clear, correct, efficient code.
Each of this book's 50 guidelines summarizes a way to write better C++, and the accompanying discussions are backed by specific examples. For this new edition, Meyers reworked every guideline in the book. The result is exceptional adherence to C++'s Draft International Standard, current compiler technology, and the latest insights into the use of C++ for real-world applications.
Each of this book's 50 guidelines summarizes a way to write better C++, and the accompanying discussions are backed by specific examples. For this new edition, Meyers reworked every guideline in the book. The result is exceptional adherence to C++'s Draft International Standard, current compiler technology, and the latest insights into the use of C++ for real-world applications.
More details
Edition
2nd edition
Language
English
Place of publication
Boston
United States
Publishing group
Pearson Education (US)
Target group
College/higher education
Dimensions
Height: 234 mm
Width: 187 mm
Thickness: 15 mm
Weight
446 gr
ISBN-13
978-0-201-92488-6 (9780201924886)
Copyright in bibliographic data and cover images is held by Nielsen Book Services Limited or by the publishers or by their respective licensors: all rights reserved.
Schweitzer Classification
Other editions
New editions

Scott Meyers
Effective C++: 55 Specific Ways to Improve Your Programs and Designs
55 Specific Ways to Improve Your Programs and Designs
Book
06/2005
3rd Edition
Addison Wesley
€48.99
Shipment within 10-20 days
Previous edition

Book
02/1992
Addison Wesley
€29.70
Article exhausted; check for reprint
Person
Scott Meyers is one of the world's foremost authorities on C++, providing training and consulting services to clients worldwide. He is the author of the best-selling Effective C++ series of books (Effective C++, More Effective C++, and Effective STL) and of the innovative Effective C++ CD. He is consulting editor for Addison Wesley's Effective Software Development Series and serves on the Advisory Board for The C++ Source (http://www.artima.com/cppsource). He holds a Ph.D. in Computer Science from Brown University. His web site is http://www.aristeia.com.
Content
Preface.
Acknowledgements.
1. Introduction.
2. Shifting From C to C++.
Prefer const and inline to #define.
Prefer iostream to stdio.h.
Prefer new and delete to malloc and free.
Prefer C++-style comments.
3. Memory Management.
Use the same form in corresponding uses of new and delete.
Use delete on pointer members in destructors.
Be prepared for out-of-memory conditions.
Adhere to convention when writing operator new and operator delete.
Avoid hiding the "normal" form of new.
Write operator delete if you write operator new.
4. Constructors, Destructors, and Assignment Operators.
Declare a copy constructor and an assignment operator for classes with dynamically allocated memory.
Prefer initialization to assignment in constructors.
List members in an initialization list in the order in which they are declared.
Make destructors virtual in base classes.
Have operator return a reference to *this.
Assign to all data members in operator.
Check for assignment to self in operator.
5. Classes and Functions: Design and Declaration.
Strive for class interfaces that are complete and minimal.
Differentiate among member functions, non-member functions, and friend functions.
Avoid data members in the public interface.
Use const whenever possible.
Prefer pass-by-reference to pass-by-value.
Don't try to return a reference when you must return an object.
Choose carefully between function overloading and parameter defaulting.
Avoid overloading on a pointer and a numerical type.
Guard against potential ambiguity.
Explicitly disallow use of implicitly generated member functions you don't want.
Partition the global namespace.
6. Classes and Functions: Implementation.
Avoid returning "handles" to internal data.
Avoid member functions that return non-const pointers or references to members less accessible than themselves.
Never return a reference to a local object or to a dereferenced pointer initialized by new within the function.
Postpone variable definitions as long as possible.
Use inlining judiciously.
Minimize compilation dependencies between files.
7. Inheritance and Object-Oriented Design.
Make sure public inheritance models "isa."
Differentiate between inheritance of interface and inheritance of implementation.
Never redefine an inherited nonvirtual function.
Never redefine an inherited default parameter value.
Avoid casts down the inheritance hierarchy.
Model "has-a" or "is-implemented-in-terms-of" through layering.
Differentiate between inheritance and templates.
Use private inheritance judiciously.
Use multiple inheritance judiciously.
Say what you mean; understand what you're saying.
8. Miscellany.
Know what functions C++ silently writes and calls.
Prefer compile-time and link-time errors to runtime errors.
Ensure that non-local static objects are initialized before they're used.
Pay attention to compiler warnings.
Familiarize yourself with the standard library.
Improve your understanding of C++.
Afterword.
Index. 0201924889T04062001
Acknowledgements.
1. Introduction.
2. Shifting From C to C++.
Prefer const and inline to #define.
Prefer iostream to stdio.h.
Prefer new and delete to malloc and free.
Prefer C++-style comments.
3. Memory Management.
Use the same form in corresponding uses of new and delete.
Use delete on pointer members in destructors.
Be prepared for out-of-memory conditions.
Adhere to convention when writing operator new and operator delete.
Avoid hiding the "normal" form of new.
Write operator delete if you write operator new.
4. Constructors, Destructors, and Assignment Operators.
Declare a copy constructor and an assignment operator for classes with dynamically allocated memory.
Prefer initialization to assignment in constructors.
List members in an initialization list in the order in which they are declared.
Make destructors virtual in base classes.
Have operator return a reference to *this.
Assign to all data members in operator.
Check for assignment to self in operator.
5. Classes and Functions: Design and Declaration.
Strive for class interfaces that are complete and minimal.
Differentiate among member functions, non-member functions, and friend functions.
Avoid data members in the public interface.
Use const whenever possible.
Prefer pass-by-reference to pass-by-value.
Don't try to return a reference when you must return an object.
Choose carefully between function overloading and parameter defaulting.
Avoid overloading on a pointer and a numerical type.
Guard against potential ambiguity.
Explicitly disallow use of implicitly generated member functions you don't want.
Partition the global namespace.
6. Classes and Functions: Implementation.
Avoid returning "handles" to internal data.
Avoid member functions that return non-const pointers or references to members less accessible than themselves.
Never return a reference to a local object or to a dereferenced pointer initialized by new within the function.
Postpone variable definitions as long as possible.
Use inlining judiciously.
Minimize compilation dependencies between files.
7. Inheritance and Object-Oriented Design.
Make sure public inheritance models "isa."
Differentiate between inheritance of interface and inheritance of implementation.
Never redefine an inherited nonvirtual function.
Never redefine an inherited default parameter value.
Avoid casts down the inheritance hierarchy.
Model "has-a" or "is-implemented-in-terms-of" through layering.
Differentiate between inheritance and templates.
Use private inheritance judiciously.
Use multiple inheritance judiciously.
Say what you mean; understand what you're saying.
8. Miscellany.
Know what functions C++ silently writes and calls.
Prefer compile-time and link-time errors to runtime errors.
Ensure that non-local static objects are initialized before they're used.
Pay attention to compiler warnings.
Familiarize yourself with the standard library.
Improve your understanding of C++.
Afterword.
Index. 0201924889T04062001