Exceptional C++(中文版)

萨特

出版时间

2012-05-31

ISBN

9787121170850

评分

★★★★★

标签

编程

书籍介绍
这本书最独特的地方,在于它不是按概念目录平铺直叙,而是抛出47个真实的工程难题,逼你先把代码写错、把坑踩穿,再回头领悟解法。读者反复提及的
AI导读
核心看点
  • 通过47个工程难题,深入讲解C++异常安全与类设计。
  • 详解Pimpl惯用法,有效降低编译依赖,提升编译速度。
  • 剖析名字查找规则与接口设计,揭示标准库背后的设计思想。
读者共识
  • 异常安全与Copy-Swap惯用法的讲解令人信服且深刻。
  • 关于编译防火墙和Pimpl的优化技巧极具实用价值。
  • 部分面向对象设计内容被认为不够深入,建议多读几遍。
精彩摘录
  • "If a function isn't going to handle (or translate or deliberately absorb) an exception, it should allow the exception to propagate up to a caller who can handle it."
  • "Always structure your code so that resources are correctly freed and data is in a consistent state even in the presence of exceptions."
  • "Observe the canonical exception safety rules: Never allow an exception to escape from a destructor or from an overloaded operator delete() or operator delete[](); write every destructor and deallocation function as though it had an exception specification of "throw()"."
  • "Observe the canonical exception-safety rules: in each function, take all the code that right emit an exception and do all that work safely off to the side. Only then, when you know that the real work has succeeded, should you modify the program state (and clean up) using only nonthrowing operations."
  • "Prefer cohesion. Always endeavor to give each piece of code – each module, each class, each function – a single, well-defined responsibility."
  • "Always use the "resource acquisition is initialization" idiom to isolate resource ownership and management."
  • "Exception specifications can incur a performance overhead whether an exception is thrown or not, although many compilers are getting better at minimizing this. For widely-used operations and general-purpose containers, it may be better not to use exception specifications in order to avoid this overh"
  • "All destructors should always be implemented as though they had an exception specification of throw() -- that is, no exception must ever be allowed to propagate."
目录
1泛型程序设计与C++标准库
条款1:迭代器难度系数
条款2:大小写不敏感的字符串——之一
条款3:大小写不敏感的字符串——之二
条款4:可重用性最高的泛型容器——之一

显示全部
用户评论
初次完整拜读一遍,以后有需要再温习~
对于异常安全的讲解很详细,其他内容也不错,但是读起来比Meyers的差一些,不知道是不是翻译的锅
感觉经验还是不够,看起来略云里雾里..这种书果然还是要和实践结合吧
这书竟然不出版了,太尴尬了。真是好书,适合多看几遍。出版社真是不知道啥是好书。
不错的一些见解,类似Effective C++
[略读]
内存管理和fast pimpl及类型转换这块看的云里雾里,异常安全性和名字查找与接口规则这块讲的很好
本书帮我改正了很多自己忽略的错误。加快编译速度的相关内容感觉非常有用。
求书
收藏