More Effective C++中文版

More Effective C++中文版
作 者: Scott·迈耶斯 侯捷 侯捷
出版社: 中国电力出版社
丛编项: 深入C++系列
版权说明: 本书为公共版权或经版权方授权,请支持正版图书
标 签: C++
ISBN 出版时间 包装 开本 页数 字数
未知 暂无 暂无 未知 0 暂无

作者简介

  译者:侯捷台湾资深技术作家、译者。闲静少言。不慕荣利。好读书。求甚解。侯捷先生以为“任何书籍如果缺少读者,再怎么优秀都将丧失价值。因此,做为一位书评人,我非常乐见评选风气兴盛。虽然所谓“喜爱”带有很大的主观成份,但这类评选仍然具有十分正面的价值,可以带给读者、作者、译者、出版者很大的参与感,对于读书风气、好书浮现率都有帮助。”深入浅出MFC(第二版)>>更多作品ScottMeyersScottMeyers:世界顶级的C++软件开发技术权威之一。他是两本畅销书EffectiveC++和MoreEffectiveC++的作者,以前曾经是C++Report的专栏作家。他经常为C/C++UsersJournal和Dr.Dobb'sJournal撰稿,也为全球范围内的客户做咨询活动。他也是AdvisoryBoardsforNumeriXLLC和InfoCruiser公司的成员。他拥有BrownUniversity的计算机科学博士学位。>>更多作品

内容简介

继 Effective C++ 之後,Scott Meyers 於 1996 推出这本「续集」。条款变得比较少,页数倒是多了一些,原因是这次选材比「第一集」更高阶,尤其是第五章。Meyers 将此章命名为技术(Techniques),并明白告诉你,其中都是一些 patterns,例如 virtual ctors、smart pointers、reference counting、proxy classes,double dispatching┅等等。这一章的每个条款篇幅都在 15~30 页之谱,实在让人有「山穷水尽疑无路,柳暗花明又一村」之叹。虽然出版年代稍嫌久远,本书并没有第二版,原因是当其出版之时(1996),C++ Standard 已经几乎定案,本书即依当时的标准草案而写。其间与现今之 C++ 标准规格几乎相同。可能变化的几个弹性之处,Meyers 也都有所说明与提示。读者可以连结作者提供的网址,看看上下两集的勘误与讨论(数量之多,令人惊恐。幸好多是技术讨论或文字斟酌,并没有什麽重大误失)。本书第一页列有它所获得的赞誉。对於读者,这是一份值得叁考的资料,我试着把它们译为中文,条列於下:Ø这是一本多方面发人深省的 C++ 书籍:不论在你偶尔用到的语言特性上,或是在你自以为十分熟悉的语言特性上。只有深刻了解 C++ 编译器如何解释你的码,你才有可能以 C++ 语言写出稳健强固的软体。本书是协助你获得此等层级之了解过程中,一份极具价值的资源。读过本书之後,我感觉像是浏览了 C++ 程式大师所检阅过的码,并获得许多极具价值的洞见。- Fred Wild, Vce President of Technology,Advantage Software echnologiesØ本书内含大量重要的技术,这些技术是撰写优良 C++ 程式所不可或缺的。本书解释如何设计和实作这些观念,以及潜伏在其他某些替代方案中的陷阱。本书亦含晚近加入之 C++ 特性的详细说明。任何人如果想要好好地运用这些新特性,最好买一本并且放在随手可得之处,以备查阅。- Chrisopher J. Van Wyk, ProfessorMahematics and Computer Science, Drew UniversityØ这是一本具备工业强度的最佳书籍。对於已经阅读过 Effetive C++ 的人,这是完美的续集。- Eric Nagl...

图书目录

译序(侯捷)

目录(Contents)

致谢(Acknowledgments. 中文版略)

导读(Introduction) 001

基础议题(Basics) 009

条款1:仔细区别 pointers 和 references 009

Distinguish between pointers and references

条款2:最好使用 C++ 转型操作符 012

Prefer C++-style casts

条款3:绝对不要以polymorphically(多态)方式来处理数组 016

Never treat arrays polymorphically

条款4:非必要不提供 default constructor 019

Avoid gratuitous default constructors

操作符(Operators) 024

条款5:对定制的型别转换函数保持警觉 024

Be wary of user-defined conversion functions

条款6:区别 increment/decrement 操作符的

前置(prefix)和后置(postfix)型式 031

Distinguish between prefix and postfix forms of increment

and decrement operators

条款7:千万不要重载 &&, ||, 和 , 操作符 035

Never overload &&, ||, or ,

条款8:了解各种不同意义的 new 和 delete 038

Understand the different meanings of new and delete

异常(Exceptions) 044

条款9:利用 destructors 避免泄漏资源 045

Use destructors to prevent resource leaks

条款10:在 constructors 内阻止资源泄漏(resource leaks) 050

Prevent resource leaks in constructors

条款11:禁止异常(exceptions)流出 destructors 之外 058

Prevent exceptions from leaving destructors

条款12:了解「掷出一个 exception」与「传递一个参数」

或「调用一个虚函数」之间的差异 061

Understand how throwing an exception differs from

passing a parameter or calling a virtual function

条款13:以 by reference 方式捕捉 exceptions 068

Catch exceptions by reference

条款14:明智运用 exception specifications 072

Use exception specifications judiciously

条款15:了解异常处理(exception handling)的成本 078

Understand the costs of exception handling

效率(Efficiency) 081

条款16:谨记 80-20 法则 082

Remember the 80-20 rule

条款17:考虑使用 lazy evaluation 085

Consider using lazy evaluation

条款18:分期摊还预期的计算成本 093

Amortize the cost of expected computations

条款19:了解暂时对象的来源 098

Understand the origin of temporary objects

条款20:协助完成「返回值优化(RVO)」 101

Facilitate the return value optimization

条款21:利用重载技术(overload)避免隐式型别转换 105

Overload to avoid implicit type conversions

条款22:考虑以操作符复合型式(op=)取代其独身型式(op)107

Consider using op= instead of stand-alone op

条款23:考虑使用其它程序库 110

Consider alternative libraries

条款24:了解 virtual functions、multiple inheritance、virtual base classes、

runtime type identification 所需的成本 113

Understand the costs of virtual functions, multiple inheritance,

virtual base classes, and RTTI

技术(Techniques, Idioms, Pattern) 123

条款25:将 constructor 和 non-member functions 虚化 123

Virtualizing constructors and non-member functions

条款26:限制某个 class 所能产生的对象数量 130

Limiting the number of objects of a class

条款27:要求(或禁止)对象产生于 heap 之中 145

Requiring or prohibiting heap-based objects

条款28:Smart Pointers(智能指针) 159

条款29:Reference counting(引用计数) 183

条款30:Proxy classes(替身类、代理类) 213

条款31:让函数根据一个以上的对象型别来决定如何虚化 228

Making functions virtual with respect to more than one object

杂项讨论(Miscellany) 252

条款32:在未来时态下发展程序 252

Program in the future tense

条款33:将非尾端类(non-leaf classes)设计为

抽象类(abstract classes) 258

Make non-leaf classes abstract

条款34:如何在同一个程序中结合 C++ 和 C 270

Understand how to combine C++ and C in the same program

条款35:让自己习惯于标准 C++ 语言 277

Familiarize yourself with the language standard

推荐书目 285

auto_ptr 实现代码 291

索引1(General Index) 295

索引2(Index of Example Classes, Functions, and Templtes) 313