Effective C++: 50 Specific Ways to Improve Your Programs and Design, 2/e
暫譯: 有效的 C++:50 種具體方法提升你的程式與設計,第二版
Scott Meyers
- 出版商: Addison Wesley
- 出版日期: 1997-09-02
- 售價: $549
- 語言: 英文
- 頁數: 256
- 裝訂: Paperback
- ISBN: 0201924889
- ISBN-13: 9780201924886
-
相關分類:
C++ 程式語言
無法訂購
買這商品的人也買了...
-
$2,050$1,948 -
$1,200$1,176 -
$680$537 -
$2,660$2,527 -
$980$774 -
$920$727 -
$880$695 -
$860$679 -
$1,900$1,805 -
$780$741 -
$280$218 -
$750$638 -
$650$514 -
$760$600 -
$590$466 -
$690$538 -
$720$562 -
$720$569 -
$290$247 -
$880$792 -
$560$442 -
$750$638 -
$560$476 -
$480$379 -
$750$593
相關主題
商品描述
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.
C++--Intermediate Programming.
Features
- Expert guidance on object-oriented design, class design, and the proper use of inheritance.
- An examination of the standard C++ library, including how the Standard Template Library and classes like string and vector affect the structure of well-written programs.
- Discussions of late-breaking language features like in-class constant initializations, namespaces, and member templates.
- Wisdom usually possessed by only the most experienced developers.

Table Of Contents
Preface.Acknowledgements.
1. Introduction.
2. Shifting From C to C++.
Prefer iostream to stdio.h.
Prefer new and delete to malloc and free.
Prefer C++-style comments.
3. Memory Management.
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.
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.
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 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.
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.
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

商品描述(中文翻譯)
描述
第一版的《Effective C++》銷售近100,000本,並被翻譯成四種語言。這很容易理解。Scott Meyers對C++的實用方法描述了專家們所採用的經驗法則——他們幾乎總是這樣做或幾乎總是避免這樣做——以產生清晰、正確、高效的代碼。
本書的50條指導方針總結了寫出更好C++的方法,並附有具體的例子作為支持。對於這一新版,Meyers重新修訂了書中的每一條指導方針。結果是對C++的草案國際標準、當前編譯器技術以及使用C++於實際應用的最新見解的卓越遵循。
適合的課程
C++--中級程式設計。
特點
- 專家對物件導向設計、類別設計及正確使用繼承的指導。
- 對標準C++庫的檢視,包括標準模板庫(Standard Template Library)及像string和vector這樣的類別如何影響良好編寫程序的結構。
- 對最新語言特性的討論,如類內常數初始化、命名空間和成員模板。
- 通常只有最有經驗的開發者才擁有的智慧。
目錄
- 前言。
- 致謝。
- 1. 介紹。
- 2. 從C轉向C++。
- 偏好使用const和inline而非#define。
- 偏好使用iostream而非stdio.h。
- 偏好使用new和delete而非malloc和free。
- 偏好使用C++風格的註解。
- 3. 記憶體管理。
- 在對應的new和delete使用中使用相同的形式。
- 在解構函數中對指標成員使用delete。
- 準備應對記憶體不足的情況。
- 在編寫operator new和operator delete時遵循慣例。
- 避免隱藏new的“正常”形式。
- 如果編寫operator new,則必須編寫operator delete。
- 4. 建構函數、解構函數和賦值運算子。
- 為具有動態分配記憶體的類別聲明複製建構函數和賦值運算子。
- 在建構函數中偏好初始化而非賦值。
- 在初始化列表中按宣告順序列出成員。
- 在基類中將解構函數設為虛擬。
- 使運算子返回對*this的引用。
- 在運算子中對所有數據成員進行賦值。
- 在運算子中檢查自我賦值。
- 5. 類別和函數:設計與宣告。
- 努力實現完整且最小的類別介面。
- 區分成員函數、非成員函數和友元函數。
- 避免在公共介面中使用數據成員。
- 儘可能使用const。
- 偏好傳參考而非傳值。
- 當必須返回對象時,不要嘗試返回引用。
- 在函數重載和參數預設之間謹慎選擇。
- 避免在指標和數值類型上進行重載。
- 防範潛在的歧義。
- 明確禁止使用不想要的隱式生成的成員函數。
- 劃分全局命名空間。
- 6. 類別和函數:實現。
- 避免返回對內部數據的“句柄”。
- 避免返回非const指標或對成員的引用的成員函數,這些成員的可訪問性低於自身。
- 絕不要返回對局部對象或在函數內部由new初始化的解引用指標的引用。
- 儘可能推遲變數定義。
- 明智地使用內聯。
- 最小化文件之間的編譯依賴性。
- 7. 繼承和物件導向設計。
- 確保公共繼承模型“isa”。
- 區分介面的繼承和實現的繼承。
- 絕不要重新定義繼承的非虛擬函數。
- 絕不要重新定義繼承的預設參數值。
- 避免向下轉換繼承層次結構。
- 通過分層建模“has-a”或“is-implemented-in-terms-of”。
- 區分繼承和模板。
- 明智地使用私有繼承。
- 明智地使用多重繼承。
- 說出你的意思;理解你所說的。
- 8. 雜項。
- 知道C++默默寫入和調用哪些函數。
- 偏好編譯時和鏈接時錯誤而非運行時錯誤。
- 確保非本地靜態對象在使用前已初始化。
- 注意編譯器警告。
- 熟悉標準庫。
- 提高對C++的理解。
- 後記。
- 索引。 0201924889T04062001