Effective C++: 50 Specific Ways to Improve Your Programs and Designs, 2nd ed.
Эффективное использование C++
Год издания: 1998
Автор: Meyers Scott / Мейерс Скотт / Мэйерс Скотт
Издательство: Addison-Wesley
Издание: 7th printing, August 1999.
ISBN: 0-201-92488-9
Язык: Английский
Формат: PDF
Качество: Отсканированные страницы + слой распознанного текста
Интерактивное оглавление: Нет
Количество страниц: 292
Перевод на русский язык:
Мейерс С. Эффективное использование C++. — М.: ДМК Пресс, 2000.
Следующее издание:
Meyers S. Effective C++, 3rd ed. — Addison-Wesley, 2005.
Описание:
This definitive guide to C++ has been updated to reflect the latest ANSI/ISO standard. With more than 50,000 copies sold, the first edition has helped thousands of developers improve their C++ programming skills. Continuing in this tradition, Meyers has reworked every item in the book and has liberally placed cross-references throughout the text.
⁂Digitized by the Internet Archive in 2022 with funding from Kahle/Austin Foundation. Спасибо Архиву за труды, а Кахлу с Остином за оплату. Я же бесплатно добавил в их пдфку нормальную нумерацию страниц и электронное оглавление (bookmarks aka outline).
Обратите внимание, что это
не последнее издание книги, на трекере есть
третье, переработанное издание, в том числе и
на русском языке.
Любопытный факт: Во втором издании 1998 года примеры программ набраны
моноширинным шрифтом (вероятно, Курьером). К 2005 году издательство Addison-Wesley утратило сей секрет оформления, и все примеры в третьем издании набраны каким-то мудацким пропрорциональным шрифтом.
Оглавление
Contents
Preface
Acknowledgments
Introduction
Shifting from C to C++
1. Prefer consts and inline to \#define
2. Prefer <iostream> to <stdio.h>
3. Prefer new and delete to malloc and free
4. Prefer C++-style comments
Memory Management
5. Use the same form in corresponding uses of new and delete
6. Use delete on pointer members in destructors
7. Be prepared for out-of-memory conditions
8. Adhere to convention when writing operator new and operator delete
9. Avoid hiding the “normal” form of new
10. Write operator operator new
Constructors, Destructors, and Assignment Operators
11. Declare a copy constructor and an assignment operator for classes with dynamically allocated memory
12. Prefer initialization to assignment in constructors
13. List members in an initialization list in the order in which they are declared
14. Make sure base classes have virtual destructors
15. Have operator= return a reference to *this
16. Assign to all data members in operator=
17. Check for assignment to self in operator=
Classes and Functions: Design and Declaration
18. Strive for class interfaces that are complete and minimal
19. Differentiate among member functions, non-member functions, and friend functions
20. Avoid data members in the public interface
21. Use const whenever possible
22. Prefer pass-by-reference to pass-by-value
23. Don’t try to return a reference when you must return an object
24. Choose carefully between function overloading and parameter defaulting
25. Avoid overloading on a pointer and a numerical type
26. Guard against potential ambiguity
27. Explicitly disallow use of implicitly generated member functions you don’t want
28. Partition the global namespace
Classes and Functions: Implementation
29. Avoid returning “handles” to internal data
30. Avoid member functions that return non-const pointers or references to members less accessible than themselves
31. Never return a reference to a local object or to a dereferenced pointer initialized by new within the function
32. Postpone variable definitions as long as possible
33. Use inlining judiciously
34. Minimize compilation dependencies between files
Inheritance and Object-Oriented Design
35. Make sure public inheritance models “isa”
36. Differentiate between inheritance of interface and inheritance of implementation
37. Never redefine an inherited nonvirtual function
38. Never redefine an inherited defaultparameter value
39. Avoid casts down the inheritance hierarchy
40. Model “has-a” or “is-implemented-in-terms-of” through layering
41. Differentiate between inheritance and templates
42. Use private inheritance judiciously
43. Use multiple inheritance judiciously
44. Say what you mean; understand what you're saying
Miscellany
45. Know what functions C++ silently writes and calls
46. Prefer compile-time and link-time errors to runtime errors
47. Ensure that non-local static objects are initialized before they're used
48. Pay attention to compiler warnings
49. Familiarize yourself with the standard library
50. Improve your understanding of C++
Afterword
Index