《More Effective C++:35个改善编程与设计的有效方法》(中文版)

《More Effective C++:35个改善编程与设计的有效方法》(中文版)china-pub计算机新书推荐

基本信息
原书名: More Effective C++: 35 New Ways to Improve Your Programs and Designs
原出版社: Addison-Wesley Professional
作者: (美)Scott Meyers
译者: 侯捷
丛书名: 传世经典书丛
出版社:电子工业出版社
ISBN:9787121125706

内容简介
继effective c++之后,scott meyers 于1996 推出这本“续集”。条款变得比较少,页数倒是多了一些,原因是这次选材比“第一集”更高阶,尤其是第5 章。meyers 将此章命名为技术(techniques),并明白告诉你,其中都是一些patterns,例如virtual constructors,smart pointers,reference counting,proxy classes,double dispatching……这一章的每个条款篇幅都达15~30 页之多,实在让人有“山重水复疑无路,柳暗花明又一村”之叹。
虽然出版年代稍嫌久远,但本书并没有第2 版,原因是当其出版之时(1996),c++ standard已经几乎定案,本书即依当时的标准草案而写,其与现今的c++标准规范几乎相同。而且可能变化的几个弹性之处,meyers也都有所说明与提示。读者可以登录作者提供的网址,看看上下两集的勘误与讨论(数量之多,令人惊恐。幸好多是技术讨论或文字斟酌,并没有什么重大误失)。

目录
译序(侯捷)
导读(introduction)
基础议题(basics)
条款1:仔细区别 pointers 和 references
distinguish between pointers and references.
条款2:最好使用 c++ 转型操作符
prefer c++-style casts.
条款3:绝对不要以多态(polymorphically)方式处理数组
never treat arrays polymorphically.
条款4:非必要不提供 default constructor
avoid gratuitous default constructors.
操作符(operators)
条款5:对定制的“类型转换函数”保持警觉
be wary of user-defined conversion functions.
条款6:区别 increment/decrement 操作符的
前置(prefix)和后置(postfix)形式
distinguish between prefix and postfix forms of increment
and decrement operators.
条款7:千万不要重载&&,和, 操作符
never overload &&, , or ,.

.条款8:了解各种不同意义的 new 和 delete
understand the different meanings of new and delete
异常(exceptions)
条款9:利用 destructors 避免泄漏资源
use destructors to prevent resource leaks.
条款10:在 constructors 内阻止资源泄漏(resource leak)
prevent resource leaks in constructors.
条款11:禁止异常(exceptions)流出 destructors 之外
prevent exceptions from leaving destructors.
条款12:了解“抛出一个 exception”与“传递一个参数”
或“调用一个虚函数”之间的差异
understand how throwing an exception differs from
passing a parameter or calling a virtual function.
条款13:以 by reference 方式捕捉 exceptions
catch exceptions by reference.
条款14:明智运用 exception specifications
use exception specifications judiciously.
条款15:了解异常处理(exception handling)的成本
understand the costs of exception handling.
效率(efficiency)
条款16:谨记 80-20 法则
remember the 80-20 rule.
条款17:考虑使用 lazy evaluation(缓式评估)
consider using lazy evaluation.
条款18:分期摊还预期的计算成本
amortize the cost of expected computations.
条款19:了解临时对象的来源
understand the origin of temporary objects.
条款20:协助完成“返回值优化(rvo)”
facilitate the return value optimization.
条款21:利用重载技术(overload)避免隐式类型转换(implict type conversions)
overload to avoid implicit type conversions.
条款22:考虑以操作符复合形式(op=)取代其独身形式(op)
consider using op= instead of stand-alone op.
条款23:考虑使用其他程序库
consider alternative libraries.
条款24:了解 virtual functions、multiple inheritance、virtual base classes、
runtime type identification 的成本
understand the costs of virtual functions, multiple inheritance,
virtual base classes, and rtti.
技术(techniques, idioms, patterns)
条款25:将 constructor 和 non-member functions 虚化
virtualizing constructors and non-member functions.
条款26:限制某个 class 所能产生的对象数量
limiting the number of objects of a class.
条款27:要求(或禁止)对象产生于 heap 之中
requiring or prohibiting heap-based objects.
条款28:smart pointers(智能指针)
条款29:reference counting(引用计数)
条款30:proxy classes(替身类、代理类)
条款31:让函数根据一个以上的对象类型来决定如何虚化
making functions virtual with respect to more than one object.
杂项讨论(miscellany)
条款32:在未来时态下发展程序
program in the future tense.
条款33:将非尾端类(non-leaf classes)设计为
抽象类(abstract classes)
make non-leaf classes abstract.
条款34:如何在同一个程序中结合 c++ 和 c
understand how to combine c++ and c in the same program.
条款35:让自己习惯于标准 c++ 语言
familiarize yourself with the language standard.
推荐读物
auto_ptr 实现代码
索引(一)(general index)
索引(二)(index of example classes,functions,and templtes)

图书详情及购买地址:
http://www.china-pub.com/197665

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
作者 : Scott Meyers 译序、导读 : 侯捷 译序(侯捷) C++ 是一个难学易用的语言! C++ 的难学,不仅在其广博的语法,以及语法背後的语意,以及语意背後的深层思维,以及深层思维背後的物件模型;C++ 的难学,还在於它提供了四种不同(但相辅相成)的程式设计思维模式:procedural-based,object-based,object-oriented,generic paradigm。 世上没有白吃的午餐。又要有效率,又要有弹性,又要前瞻望远,又要回溯相容,又要能治大国,又要能烹小鲜,学习起来当然就不可能太简单。 在如此庞大复杂的机制下,万千使用者前仆後续的动力是:一旦学成,妙用无穷。C++ 相关书籍之多,车载斗量;如天上繁星,如过江之鲫。广博如四库全书者有之(The C++ Programming Language、C++ Primer),深奥如重山复水者有之(The Annotated C++ Reference Manual, Inside the C++ Object Model),细说历史者有之(The Design and Evolution of C++, Ruminations on C++),独沽一味者有之(Polymorphism in C++, Genericity in C++),独树一帜者有之(Design Patterns,Large Scale C++ Software Design, C++ FAQs),程式库大全有之(The C++ Standard Library),另辟蹊径者有之(Generic Programming and the STL),工程经验之累积亦有之(Effective C++, More Effective C++, Exceptional C++)。 这其中,「工程经验之累积」对已具C++ 相当基础的程式员而言,有著致命的吸引力与立竿见影的帮助。Scott Meyers 的Effective C++ 和More Effective C++ 是此类佼佼,Herb Sutter 的Exceptional C++ 则是後起之秀。 这类书籍的一个共通特色是轻薄短小,并且高密度地纳入作者浸淫於C++/OOP 领域多年而广泛的经验。它们不但开展读者的视野,也为读者提供各种C++/OOP 常见问题或易犯错误的解决模型。某些小范围主题诸如「在base classes 中使用virtual destructor」、「令operator= 传回*this 的reference」,可能在百科型C++ 语言书籍中亦曾概略提过,但此类书籍以深度探索的方式,让我们了解问题背後的成因、最佳的解法、以及其他可能的牵扯。至於大范围主题,例如smart pointers, reference counting, proxy classes,double dispatching, 基本上已属design patterns 的层级! 这些都是经验的累积和心血的结晶。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值