深度探索C++对象模型

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Author(s): Stanley Lippman,侯捷
Edition: 1
Publisher: 电子工业出版社
Year: 2012

Language: Chinese

封面
书名
版权
本立道生(侯捷 译序)
前言(Stanley B.Lippman)
导读(译者的话)
目录
第1章 关于对象(Object Lessons)
加上封装后的布局成本(Layout Costs for Adding Encapsulation)
1.1 C++对象模式(The C++ Object Model)
简单对象模型(A Simple Object Model)
表格驱动对象模型(A Table-driven Object Model)
C++对象模型(The C++ Object Model)
对象模型如何影响程序(How the Object Model Effects Programs)
1.2 关键词所带来的差异(A Keyword Distinction)
关键词的困扰
策略性正确的struct(The Politically Correct Struct)
1.3 对象的差异(An Object Distinction)
指针的类型(The Type of a Pointer)
加上多态之后(Adding Polymorphism)
第2章 构造函数语意学(The Semantics of Constructors)
2.1 Default Constructor的构造操作
“带有Default Constructor”的Member Class Object
“带有Default Constructor”的Base Class
“带有一个Virtual Function”的Class
“带有一个Virtual Base Class”的Class
总结
2.2 Copy Constructor的构造操作
Default Memberwise Initialization
Bitwise Copy Semantics(位逐次拷贝)
不要Bitwise Copy Semantics!
重新设定Virtual Table的指针
处理Virtual Base Class Subobject
2.3 程序转化语意学(Program Transformation Semantics)
显式的初始化操作(Explicit Initialization)
参数的初始化(Argument Initialization)
返回值的初始化(Return Value Initialization)
在使用者层面做优化(Optimization at the User Level)
在编译器层面做优化(Optimization at the Compiler Level)
Copy Constructor:要还是不要?
摘要
2.4 成员们的初始化队伍(Member Initialization List)
第3章 Data语意学(The Semantics of Data)
3.1 Data Member的绑定(The Binding of a Data Member)
3.2 Data Member的布局(Data Member Layout)
3.3 Data Member的存取
Static Data Members
Nonstatic Data Members
3.4 “继承”与Data Member
只要继承不要多态(Inheritance without Polymorphism)
加上多态(Adding Polymorphism)
多重继承(Multiple Inheritance)
虚拟继承(Virtual Inheritance)
3.5 对象成员的效率(Object Member Efficiency)
3.6 指向Data Members的指针(Pointer to Data Members)
“指向Members的指针”的效率问题
第4章 Function语意学(The Semantics of Function)
4.1 Member的各种调用方式
Nonstatic Member Functions(非静态成员函数)
Virtual Member Functions(虚拟成员函数)
Static Member Functions(静态成员函数)
4.2 Virtual Member Functions(虚拟成员函数)
多重继承下的Virtual Functions
虚拟继承下的Virtual Functions
4.3 函数的效能
4.4 指向Member Function的指针(Pointer-to-Member Functions)
支持“指向Virtual Member Functions”的指针
在多重继承之下,指向Member Functions的指针
“指向Member Functions之指针”的效率
4.5 Inline Functions
形式参数(Formal Arguments)
局部变量(Local Variables)
第5章 构造、析构、拷贝语意学(Semantics of Construction,
Destruction, and Copy)
纯虚函数的存在(Presence of a Pure Virtual Function)
虚拟规格的存在(Presence of a Virtual Specification)
虚拟规格中const的存在
重新考虑class的声明
5.1 “无继承”情况下的对象构造
抽象数据类型(Abstract Data Type)
为继承做准备
5.2 继承体系下的对象构造
虚拟继承(Virtual Inheritance)
vptr初始化语意学(The Semantics of the vptr Initialization)
5.3 对象复制语意学(Object Copy Semantics)
5.4 对象的效能(Object Efficiency)
5.5 析构语意学(Semantics of Destruction)
第6章 执行期语意学(Runtime Semantics)
6.1 对象的构造和析构(Object Construction and Destruction)
全局对象(Global Objects)
局部静态对象(Local Static Objects)
对象数组(Array of Objects)
Default Constructors和数组
6.2 new和delete运算符
针对数组的new语意
Placement Operator new的语意
6.3 临时性对象(Temporary Objects)
临时性对象的迷思(神话、传说)
第7章 站在对象模型的尖端(On the Cusp of the Object Model)
7.1 Template
Template的“实例化”行为(Template Instantiation)
Template的错误报告(Error Reporting within a Template)
Template中的名称决议法(Name Resolution within a Template)
Member Function的实例化行为(Member Function Instantiation)
7.2 异常处理(Exception Handling)
Exception Handling快速检阅
对Exception Handling的支持
7.3 执行期类型识别(Runtime Type Identification,RTTI)
Type-Safe Downcast(保证安全的向下转换操作)
Type-Safe Dynamic Cast(保证安全的动态转换)
References并不是Pointers
Typeid运算符
7.4 效率有了,弹性呢?
动态共享函数库(Dynamic Shared Libraries)
共享内存(Shared Memory)