Imperfect C++(英文版)

Imperfect C++(英文版)
作 者: 维尔逊
出版社: 人民邮电出版社
丛编项: 典藏原版书苑
版权说明: 本书为公共版权或经版权方授权,请支持正版图书
标 签: 暂缺
ISBN 出版时间 包装 开本 页数 字数
未知 暂无 暂无 未知 0 暂无

作者简介

  本书提供作译者介绍Matthew Wilson是一名软件开发顾问,STL Soft库的创建者。他为双月刊C/C++Users Journal撰写关于将C/C++与其他语言和技术进行整合的专栏文章,同时也是C++ Experts Forum的在线专栏作家。Wilson在英国曼彻斯特大学获得了博士学位,有十余年c++开发经验,目前定居子澳大利亚。...

内容简介

即便是C++阵营里最忠实的信徒,也不得不承认:C++语言并不完美。实际上,世界上也没有完美的编程语言。.如何克服C++类型系统的不足?在C++中,如何利用约束、契约和断言来实施软件设计?如何处理被C++标准所忽略的动态库、静态对象以及线程等有关的问题?隐式转换有何替代方案?本书将为你一一解答这些问题。针对C++的每一个不完美之处,本书都具体地分析原因,并探讨实用的解决方案。书中也不乏许多作者创新的、你从未听说过或使用的技术,但这些确实能帮助你成为C++方面的专家。..本书适合有一定经验的C++程序员和项目经理阅读,也适合对C++编程的一些专门或高级话题感兴趣的读者参考。本书特色:1.本书不仅指出了C++的缺失,更为编写健壮、灵活、高效,可维护的代码提供了实用的技术和工具。2.本书展示了如何克服C++的复杂性,穿越C++庞大的范式阵列,夺回对代码的控制权,从而获得更理想的结果。...

图书目录

Contents

PART ONE Fundamentals

Chapter 1 Enforcing Design: Constraints,Contracts,and Assertions

1.1 Eggs and Ham

1.2 Compile-Time Contracts :Constraints

1.3 RuntimeContracts:Preconditions,Postconditions,and Invariants

1.4 Assertions

Chapter 2 Object Lifetime

2.1 The Object Life Cycle

2.2Controlling Your Clients

2.3 MILs and Boon

Chapter 3 Resource Encapsulation

3.1 A Taxonomy of Resource Encapsulation

3.2 POD Types

3.3 Wrapper Proxies

3.4 RRID Tyes

3.5 RAII Types

3.6 RAII Coda

Chapter 4 Data Encapsulation and Value Types

4.1 A Taxonomy of Data Encapsulation

4.2 Value Types and Entity Types

4.3A Taxonomy of Value Types

4.4 Open Types

4.5 Encapsulated Types

4.6 Value Types

4.7 Arithmetic Value Types

4.8 Value Types Coda

4.9 Encapsulation Coda

Chapter 5 Object Access Models

5.1 Vouched Lifetimes

5.2 Copied for Caller

5.3 Givren to Caller

5.4 Shared Objects

Chapter 6 Scoping Classes

6.1 Value

6.2 State

6.3APIs and Services

6.4 Language Features

PART TWO Surviving the Real World

Chapter 7 ABI

7.1Sharing Code

7.2 C ABI Requirements

7.3 C++ ABI Reqquirements

7.4 I Can C Clearly Now

Chapter 8 Objects Across Borders

8.1 Mostly Portable vtables?

8.2 Portable vtables

8.3 ABI/OAB Coda

Chapter 9 Dynamic Libraries

9.1 Calling Functions Explicitly

9.2 Indentity:Link Units and Link Space

9.3 Lifetime

9.4 Versioning

9.5 Resource Ownership

9.6 Dynamic Libraries: Coda

Chapter 10 Threading

10.1 Synchronizing Integer Access

10.2 Synchrongizing Block Access: Critical Regions

10.3 Atomic Integer Performance

10.4 Multithreading Extensions

10.5 Thread Specific Storage

Chapter 11 Statics

11.1 Nonlocal Static Objects : Globals

11.2 Singletons

11.3 Function-Local Static Objects

11.4 Static Members

11.5 Statics Coda

Chapter 12 Optmization

12.1 Inline Functions

12.2 Return Value Optimization

12.3 Empty Base Optimization

12.4 Empty Derived Optimization

12.5 Preventing Optimization

PART THREE Language Concerna

Chapter 13 Fundamental Types

13.1 May I Have a byte?

13.2 Fixed-Sized Integer Types

13.3 Large Interger Types

13.4 Dangerous Types

Chapter 14 Arrays and Pointers

14.1Dont’t Repeat Youself

14.2 Arrays Decay into Pointers

14.3 dimensionof()

14.4 Cannot Pass Arrays to Functions

14.5 Arrays Are Always Passed By Address

14.6 Arrays OF Inherited Types

14.7 Cannot Have Multidimensional Arrays

Chapter 15 Values

15.1 NULL---The Keyword That Wasn’t

15.2 Down to Zero

15.3 Bending the Truth

15.4 Literals

15.5 Constants

Chapter 16 Keywords

16.1 interface

16.2 temporary

16.3 ownetr

16.4 explicit(_cast)

16.5 unique

16.6 final

16.7 Unsupported Keywords

Chapter 17 Syntax

17.1 Class Layout

17.2 Conditional Expressions

17.3 for

17.4 Variable Notation

Chapter 18 Typedefs

18.1 Pointer typedefs

18.2 What’s in a Definition?

18.3 Aliases

18.4 True Typedefs

18.5 The Good, the Bad,and the Ugly

PART FOUR Cognizant Conversions

Chapter 19 Casts

19.1 Implicit Conversion

19.2 Casting in C++

19.3 The Case for C Casts

19.4 Casts on Steroids

19.5 explicit_cast

19.6 literal_cast

19.7union_cast

19.8 comstl::interface_cast

19.9 boost::polymorphic_cast

19.10 Casts: Coda

Chapter 20 Shims

20.1 Embracing Change and Enhancing Flexibility

20.2 Attribute Shims

20.3 Logical Shims

20.4 Control Shims

20.5 Conversion Shims

20.6 Composite Shim Concepts

1.1 Namespaces and Koenig Lookup

1.2 Why Not Traits?

1.3 Structural Conformance

1.4 Breaking Up the Monolith

1.5 Shims:Coda

Chapter 21 Veneers

21.1 Lightweight RaII

21.2Binding Data and Operations

21.3 Rubbing Up to Concepts

21.4 Veneers:Coda

Chapter 22 Bolt-ins

22.1 Adding Functionality

22.2 Skin Selection

22.3 Nonvirtual Overriding

22.4 Leveraging Scope

22.5 Simulated Compile-Time Polymorphism:Rererse Bolt-ins

22.6 Parameterized Polymorphic Packaging

22.7 Bolt-ins:Coda

Chapter 23 Template Constructors

23.1 Hidden Costs

23.2 Dangling References

23.3 Template Constructor Specialization

23.4 Argument Proxies

23.5 Argument Targeting

23.6 Template Constructors: Coda

PART FIVE Operators

Chapter 24 operator bool()

24.1 operator int() const

24.2 operator void*()const

24.3 operator!()_not!

24.4 operator boolean const*() const

24.5 operator boolean const 8() const

24.6 operator int boolean::*()const

24.7 Operating in the Real World

24.8 operator!

Chapter 25 Fast,Non-intrusive String Concatenation

25.1 fast_string_concatenator<>

25.2 Performance

25.3 Working with Other String Classes

25.4 Concatenation Seeding

25.5 Pathological Bracing

25.6 Standardization

Chapter 26 What’s Your Address?

26.1 Can’t Get the Real Address

26.2 What Actions Are Carried Out during Conversion?

26.3 What Do We Return?

26.4 What’s Your Address:Coda

Chapter 27 Subscript Operators

27.1 Pointer Conversion versus Subscript Operators

27.2 Handling Errors

27.3 Return Value

Chapter 28 Increment Operators

28.1 Missing Postfix Operators

28.2 Efficiency

Chapter 29 Arithmetic Types

29.1 Class Definition

29.2 Default Construction

29.3 Initialization(Value Construction)

29.4 Copy Construction

29.5 Assignment

29.6 Arithmetic Operators

29.7 Comparison Operators

29.8 Accessing the Value

29.9 sinteger64

29.10 Truncations ,Promotions,and Tests

29.11 Arithmetic Types:Code

Chapter 30 Short-circuit !

PART SIX Extending C++

Chapter 31 Return Value Lifetime

31.1 A Taxonomy of Return Value Lifetime Gotchas

31.2 Why Return-by-Reference?

31.3 Solution1—integer_to_string<>

31.4 Solution2—TSS

31.5 Solution3—Extending RVL

31.6Solution4—Conversion Shims

31.7 Solution5—Conversion Shims

31.8 Performance

31.9 RVL:The Big Win for Garbage Colletion

31.10 Potential Applications

31.11 Return Value Lifetime:Coda

Chapter 32 Memory

32.1 A Taxonomy of Memory

32.2 The Best of Both Worlds

32.3 Allocators

32.4 Memory: Coda

Chapter 33 Multidimensional Arrays

33.1 Facilitating Subscript Syntax

33.2 Sized at Run Time

33.3 Sized at Compile Time

33.4 Block Access

33.5 Performance

33.6 Multidimensional Arrays:Coda

Chapter 34 Functors and Ranges

34.1 Syntactic Clutter

34.2 for_all()?

34.3 Local Functors

34.4 Ranges

34.5Functors and Ranges: Coda

Chapter 35 Properties

35.1 Compiler Extensions

35.2 Implementation Options

35.3 Field Properties

35.4 Method Properties

35.5 Static Properties

35.6 Virtual Properties

35.7 Property Uses

35.8 Properties:Coda

Appendix A Compilers and Libraries

A.1 Compilers

A.2 Libraries

A.3 Other Resources

Appendix B “Watch That Hubrist!”

B.1 Operator Overload

B.2 DRY Rued Yesterday

B.3 Paranoid Programming

B.4 To Insanity,and Beyond!

Appendix C Arturius

Appendix D The CD

Epilogue

Bibliography

Index