More Exceptional C++中文版

[美] Herb Sutter

出版时间

2002-09-01

ISBN

9787560927718

评分

★★★★★
书籍介绍
More Exceptional C++是Exceptional C++的续篇。根据多年程序开发的实践经验、Herb Sutter向C++程序员提供了久经考验的程序设计技术和行之有效的解决方案,这些技术和方案对设计从小型工程到企业级应用的现代软件系统大有裨益。 围绕着40个编程难题, More Exceptional C++引导读者深刻理解成功的C++软件设计和开发中至关重要的原则和议题。书中包括一些新的主题,强化了泛型程序设计、内存管理、C++标准库的使用等内容,并涵盖了traits和predicates这样的重要技术;还就使用标准容器和算法时应该牢记的准则和要点进行了分析——其它资料很少深入涉及这一主题。 读者可以在书中找到以下重要问题的解决方案:使用std::map和std::set时会遇到哪些陷阱?如何安全地避免这些陷阱?何种predicates可以安全地和STL一起使用?何种不行?为什么?想通过“与模板协同工作的类型”的能力改变模板自身的行为吗?有什么现有的技术可以写出这种威力强大的通用模板代码?何时应该优化你的代码?如何优化?为什么花哨的优化会(而且的确会)让我们陷入麻烦?如何你是在撰写多线程安全代码,这些问题的某些答案会如何变化?异常安全问题会影响到类的设计吗?或者,它可以只是作为事后的改进手段来使用吗?在结合使用不同供应商提供的基于继承的程序库时,如何避免连体双婴问题?如何安全地使用auto-ptr?如何运用常见的设计模式来改装它,使之消除常见缺陷?可以将auto-ptr用作类的成员吗?在这样做之前,你应该了解些什么? 还有,现代C++中最常见的问题之一:到底在何时使用名字空间?如何使用? More Exceptional C++是真正的程序员的必读之物,在展示如何用C++撰写优质代码的同时,它为读者提供了对语言彻底而实用的理解。
精彩摘录
  • "精简会带来晦涩,过度的精简不适合应用到产品代码中。 准则:尽量提高可读性,避免编写晦涩的精简代码。"
  • "Make a function inline directs the compiler that it may choose to place a copy of the function's code directly into each place the code is used. In the cases where the compiler does so, it avoids generating a function call."
  • "If you're looking to improve efficiency in some way, always look to your algorithms and data structures first."
  • "Finally, note another practical reason for this: Profilers are a lot less good at identifying which inlined functions should NOT be inlined."
  • "Avoid inlining or detailed tuning until performance profiles prove the need."
  • "Without atomic integer operations, copy-on-write typically incurs a significant performance penalty. Even with atomic operations, COW can make common String operations take nearly 50% longer, even in single-threaded programs."
  • "In general, copy-on-write is often a bad idea in multithread-ready code. That's because the calling code can no longer know whether two distinct String objects actually share the same representation under the covers, so String must incur overhead to do enough serialization so that calling code can t"
  • "Most of COW(copy-on-write)'s primary advantage for small strings could be gained without COW by using a more efficient allocator."
用户评论
经典的C++书籍之一,工程经验积累。
同EC++一样,每个C++程序员必看的一本书。
翻译很好,值得表扬。
防身必备。
当时这一系列的C++书是百读不厌!
读了类继承,内存,还有智能指针那些章节,有些东西在其他书里面看到过了,感觉我原来看到过的那些书阐述得更好,其他章节的话,目前我还用不到,不太想看,比较细节的东西,用到了再来看看这些注意事项吧
这本比上一本要好读
相比Exceptional C++来有所不及
除了异常相关的读完. 虽然在难度打分上比expectional低,但是个人感觉反而更难一点. 都是很实用的细节...如果面试问到这些条款,并且能回答出,已经算high level的C++ programmer了吧。 是不是我对自己要求太低了....
下载
收藏