售价: ¥693.00 待定配送费
亚马逊的其他卖家
加入购物车
¥696.10
此商品可以享受免费配送 详情
卖家: 亚马逊
前翻 后翻
正在播放... 已暂停   您正在聆听的 Audible 音频版本的样品。
了解更多信息
查看全部 3 张图片

C++ Coding Standards: 101 Rules, Guidelines, and Best Practices (英语) 平装 – 2004年11月4日

平均4.5 星
5 星
28
4 星
9
3 星
5
2 星
1
1 星
0
平均4.5 星 43条亚马逊美国的评论 us-flag |
| 天天低价·正品质优
|
分享
广告

显示所有 格式和版本 隐藏其他格式和版本
亚马逊价格
全新品最低价 非全新品最低价
平装
"请重试"
¥693.00
¥693.00
促销信息: 优惠 买满 ¥88.00 立减 ¥10.00 共1个促销

全新品2 售价从 ¥693.00

click to open popover

商品促销和特殊优惠
  • 买满 ¥88.00 立减 ¥10.00: 满足条件自动优惠

看过此商品后顾客买的其它商品?

无需Kindle设备,下载免费Kindle阅读软件,即可在您的手机、电脑及平板电脑上畅享阅读。

  • iPhone/iPad/Mac
  • Android手机或平板电脑

请输入您的手机号码,获取Kindle阅读软件的下载链接。



基本信息

  • 出版社: Addison-Wesley Professional; 1 (2004年11月4日)
  • 丛书名: C++ in Depth Series
  • 平装: 240页
  • 语种: 英语
  • ISBN: 0321113586
  • 条形码: 9780321113580, 0076092018117
  • 商品尺寸: 18.5 x 1.5 x 23.1 cm
  • 商品重量: 481 g
  • ASIN: 0321113586
  • 用户评分: 分享我的评价
  • 亚马逊热销商品排名: 图书商品里排第1,394,783名 (查看图书商品销售排行榜)
  • 您想告诉我们您发现了更低的价格?

商品描述

作者简介

Herb Sutter is the author of three highly acclaimed books, Exceptional C++ Style, Exceptional C++, and More Exceptional C++ (Addison-Wesley). He chairs the ISO C++ standards committee, and is contributing editor and columnist for C/C++ Users Journal. As a software architect for Microsoft, Sutter leads the design of C++ language extensions for .NET programming.

Andrei Alexandrescu is the author of the award-winning book Modern C++ Design (Addison-Wesley, 2001) and is a columnist for C/C++ Users Journal.



目录

Preface.

1. Organizational and Policy Issues.

    Don't sweat the small stuff. (Or: Know what not to standardize.).

    Compile cleanly at high warning levels.

    Use an automated build system.

    Use a version control system.

    Invest in code reviews.

2. Design Style.

    Give one entity one cohesive responsibility.

    Correctness, simplicity, and clarity come first.

    Know when and how to code for scalability.

    Don't optimize prematurely.

    Don't pessimize prematurely.

    Minimize global and shared data.

    Hide information.

    Know when and how to code for concurrency.

    Ensure resources are owned by objects. Use explicit RAII and smart pointers.

3. Coding Style.

    Prefer compile- and link-time errors to run-time errors.

    Use const proactively.

    Avoid macros.

    Avoid magic numbers.

    Declare variables as locally as possible.

    Always initialize variables.

    Avoid long functions. Avoid deep nesting.

    Avoid initialization dependencies across compilation units.

    Minimize definitional dependencies. Avoid cyclic dependencies.

    Make header files self-sufficient.

    Always write internal #include guards. Never write external #include guards.

4. Functions and Operators.

    Take parameters appropriately by value, (smart) pointer, or reference.

    Preserve natural semantics for overloaded operators.

    Prefer the canonical forms of arithmetic and assignment operators.

    Prefer the canonical form of ++ and --. Prefer calling the prefix forms.

    Consider overloading to avoid implicit type conversions.

    Avoid overloading &&, , or , (comma).

    Don't write code that depends on the order of evaluation of functionarguments.

5. Class Design and Inheritance.

    Be clear what kind of class you're writing.

    Prefer minimal classes to monolithic classes.

    Prefer composition to inheritance.

    Avoid inheriting from classes that were not designed to be base classes.

    Prefer providing abstract interfaces.

    Public inheritance is substitutability.

    Inherit, not to reuse, but to be reused.

    Practice safe overriding.

    Consider making virtual functions nonpublic, and public functions nonvirtual.

    Avoid providing implicit conversions.

    Make data members private, except in behaviorless aggregates (C-stylestructs).

    Don't give away your internals.

    Pimpl judiciously.

    Prefer writing nonmember nonfriend functions.

    Always provide new and delete together.

    If you provide any class-specific new, provide all of the standard forms (plain, in-place, and nothrow).

6. Construction, Destruction, and Copying.

    Define and initialize member variables in the same order.

    Prefer initialization to assignment in constructors.

    Avoid calling virtual functions in constructors and destructors.

    Make base class destructors public and virtual, or protected and nonvirtual.

    Destructors, deallocation, and swap never fail.

    Copy and destroy consistently.

    Explicitly enable or disable copying.

    Avoid slicing. Consider Clone instead of copying in base classes.

    Prefer the canonical form of assignment.

    Whenever it makes sense, provide a no-fail swap (and provide it correctly).

7. Namespaces and Modules.

    Keep a type and its nonmember function interface in the same namespace.

    Keep types and functions in separate namespaces unless they're specifically intended to work together.

    Don't write namespace usings in a header file or before an #include.

    Avoid allocating and deallocating memory in different modules.

    Don't define entities with linkage in a header file.

    Don't allow exceptions to propagate across module boundaries.

    Use sufficiently portable types in a module's interface.

8. Templates and Genericity.

    Blend static and dynamic polymorphism judiciously.

    Customize intentionally and explicitly.

    Don't specialize function templates.

    Don't write unintentionally nongeneric code.

9. Error Handling and Exceptions.

    Assert liberally to document internal assumptions and invariants.

    Establish a rational error handling policy, and follow it strictly.

    Distinguish between errors and non-errors.

     Design and write error-safe code.

    Prefer to use exceptions to report errors.

    Throw by value, catch by reference.

    Report, handle, and translate errors appropriately.

    Avoid exception specifications.

10. STL: Containers.

    Use vector by default. Otherwise, choose an appropriate container.

    Use vector and string instead of arrays.

    Use vector (and string::c_str) to exchange data with non-C++ APIs.

    Store only values and smart pointers in containers.

    Prefer push_back to other ways of expanding a sequence.

    Prefer range operations to single-element operations.

    Use the accepted idioms to really shrink capacity and really erase elements.

11. STL: Algorithms.

    Use a checked STL implementation.

    Prefer algorithm calls to handwritten loops.

    Use the right STL search algorithm.

    Use the right STL sort algorithm.

    Make predicates pure functions.

    Prefer function objects over functions as algorithm and comparer arguments.

    Write function objects correctly.

12. Type Safety.

    Avoid type switching; prefer polymorphism.

    Rely on types, not on representations.

    Avoid using reinterpret_cast.

    Avoid using static_cast on pointers.

    Avoid casting away const.

    Don't use C-style casts.

    Don't memcpy or memcmp non-PODs.

    Don't use unions to reinterpret representation.

    Don't use varargs (ellipsis).

    Don't use invalid objects. Don't use unsafe functions.

    Don't treat arrays polymorphically.

Bibliography.

Summary of Summaries.

Index.

商品评论

在亚马逊中国上尚未有买家评论。
5 星
4 星
3 星
2 星
1 星

此商品在美国亚马逊上最有用的商品评论 (beta) (可能包括"Early Reviewer Rewards Program"的评论)

美国亚马逊: 平均4.5 星 43 条评论
平均5.0 星 A must have for C++ professional (from novice to expert) 2016年9月30日
评论者 Stefano Buora - 已在美国亚马逊上发表
版本: 平装 已确认购买
I've been a programmer since the earliest 90's, a professional software engineer since the 2000, and I would say that book contains many of the things you learn through your carrier, exposed in a very pleasant way.
101 rules, mostly described in one or 2 pages make it a good reading before fall asleep, a good reminder of best practices that should not be forgotten. In these times, where code reviews are part of our daily activity, being aligned and focused makes the job more easy.
For novice it's for sure a good set of best-practices to be learned. For intermediate-expert it provides a clean and well focused reasoning on every single rule, good for tutoring and nice nuts of knowledge.

A must have.
7/8 人认为此评论有用
平均5.0 星 Packed with time tested great advice 2004年11月28日
评论者 Mitchel J. Haas - 已在美国亚马逊上发表
版本: 平装 已确认购买
This is a must read for intermediate level and higher programmers. One of the book's strengths is its conciseness, which makes it easier to read without getting tied up in a lot of details. Because of this, the reader must take it upon himself/herself to check the readings in the supplied references (given for each rule) to completely understand the terms/idioms/ideas mentioned in the rule. This is not at all a weakness in the book, as it's purpose is to summarize the rule/guideline/practice, so they can put it to use, while leaving it up to the reader to refer to readings in the given references, to obtain a greater understanding of the ideas used in that rule. Most of the references can be found in the authors' previous works. The book also makes reference to standard time tested design patterns and ideas, so it would be good to have the text "Design Patterns" read, or close by.
1/2 人认为此评论有用
平均4.0 星 Much more that a list of coding standards 2011年2月4日
评论者 Robert H. Stine Jr. - 已在美国亚马逊上发表
版本: 平装 已确认购买
You know it's a book for geeks if there are 101 tips but the numbering starts at zero. That said, this book is outstanding. It was everything I had hoped the new edition of Meyers's "Effective C++". In particular, if you learned C++ a while ago but need to get up to speed with the latest developments in RAII, templates, etc., then I can't imagine a better book.

The only reason I did not give it 5 stars is that now and then the language is just too clunky. In particular, I had to read "...the name lookup for that operator function might reach out into the name space...Whether it reaches out into N..." a few times before I understood that "reaching out into" is meant to be a synonym for "reach into".

On the whole, however, the book is quite readable, and the code examples hit the sweet spot of demonstrating the topic of discussion without being overly long.
平均5.0 星 Think of this as a Miniature Roadmap that shows you how to avoid potholes on the roads 2014年4月27日
评论者 Eli - 已在美国亚马逊上发表
版本: 平装 已确认购买
Every programming language has a list of caveats and things you generally shouldn't do; although it is a bit outdated, many of the concepts are still very applicable to modern day C++ programming. However, this book really shines because it tells you the caveat and tells how what to look out for if you do decide to implement the design. So it doesn't take a "Don't ever do this" approach that many other design books take.
平均4.0 星 Good to review for standards 2014年11月1日
评论者 Brian Lawler - 已在美国亚马逊上发表
版本: 平装 已确认购买
Covers coding standards for C++. Good to review for standards, guidelines, etc. that you want to implement in a specific project. Reflects choices, some that may fit your project and some that may not, so best used as a list of possible guidelines. So, choice and decision would be involved before using these... just blindly trying to use them all is not a good idea.