深度探索C++对象模型(影印版)
[特价中]基本信息
- 原书名: Inside the C++ Object Model
- 原出版社: Pearson Education
内容简介回到顶部↑
本书重点论述了C++面向对象程序设计的底层机制,包括结构式语意,暂时性对象的生成、封装、继承和虚拟——虚拟函数和虚拟继承。书中向你表明:理解底层实现模型,可以极大地提高你的编码效率。Lippman澄清了那些关于C++系统开销与复杂性的各种错误信息和猜测,指出了其中某些成本和利益交换确实存在。他在书中详述了各种实现模型,指出了它们的发展方向以及促使其发展的根本原因。本书涵盖了C++对象模型的语意暗示,并指出了这个模型是如何对程序造成影响的。
探索“面向对象程序所支持的C++对象模型”中的程序行为。
对于“面向对象特点的基础实现技术”以及“有关这些特点的隐含利益交换”提供了一个清楚的认识。
检验由程序变形体带来的效率冲击。
提供丰富的程序范例、图表,以及面向对象概念和底层对象模型之间的效率测量。
探索“面向对象程序所支持的C++对象模型”中的程序行为。
对于“面向对象特点的基础实现技术”以及“有关这些特点的隐含利益交换”提供了一个清楚的认识。
检验由程序变形体带来的效率冲击。
提供丰富的程序范例、图表,以及面向对象概念和底层对象模型之间的效率测量。
作译者回到顶部↑
本书提供作译者介绍
Stanley B.Lippman目前已应微软邀请,加盟了Visual C++开发小组。此前他曾在贝尔实验室领导过cfront 3.0和2.1的编译器开发小组,并曾是Bjarne Stroustrup所领导的贝尔实验室基础项目中的一员。Stan是《C++ Primer》(3个版次,该书第三版的中文版已由中国电力出版社出版)及《Inside The C++ Object Model》(该书的影印版已由中国电力出版社出版)的作者,这些极为成功的书籍由Addison-Wesley出版。他也是《C++ Gems》的编辑,该书由Cambridge University Press出版。
.. << 查看详细
.. << 查看详细
目录回到顶部↑
object lessons 1
layout costs for adding encapsulation 5
1.1 the c++ object model 6
a simple object model 6/ a table-driven object model 7/
the c++ object model/ how the object model effects programs
1.2 a keyword distinction 12
keywords schmeewords 13/ the politically correct struct 16
1.3 an object distinction 18
the type of a pointer 24/ adding polymorphism 25
2 the semantics of constructors 31
2.1 default constructor construction 32
member class object with default constructor 34/ base
class with default constructor 37/ class with a virtual
function 37/ class with a virtual base class 38/
summary 39
2.2 copy constructor construction 40
default memberwise initialization 41/ bitwise copy semantics 43/ bitwise copy semantics---not! 45/ resetting
the virtual table pointer 45/ handling the virtual base
class subobject 47
2.3 program transformation semantics 50
layout costs for adding encapsulation 5
1.1 the c++ object model 6
a simple object model 6/ a table-driven object model 7/
the c++ object model/ how the object model effects programs
1.2 a keyword distinction 12
keywords schmeewords 13/ the politically correct struct 16
1.3 an object distinction 18
the type of a pointer 24/ adding polymorphism 25
2 the semantics of constructors 31
2.1 default constructor construction 32
member class object with default constructor 34/ base
class with default constructor 37/ class with a virtual
function 37/ class with a virtual base class 38/
summary 39
2.2 copy constructor construction 40
default memberwise initialization 41/ bitwise copy semantics 43/ bitwise copy semantics---not! 45/ resetting
the virtual table pointer 45/ handling the virtual base
class subobject 47
2.3 program transformation semantics 50
前言回到顶部↑
For nearly a decade within Bell Laboratories, I labored at implementing C++. First it was on cfront, Bjarne Stroustrup's original C++ implementation (from Release 1.1 back in 1986 through Release 3.0, made available in September 1991). Then it was on to what became known internally as the Simplifier, the C++ Object Model component of the Foundation project. It was during the Simplifier's design period that I conceived of and began working on this book.
What was the Foundation project? Under Bjarne's leadership, a small group of us within Bell Laboratories was exploring solutions to the problems of large-scale programming using C++. The Foundation was an effort to define a new development model for the construction of large systems
(again, using C++ only; we weren't providing a multilingual solution). It was an exciting project, both for the work we were doing and for the people doing the work: Bjarne, Andy Koenig, Rob Murray, Martin Carroll, Judy Ward, Steve Buroff, Peter Juhl, and myself. Barbara Moo was supervising the gang of us other than Bjarne and Andy. Barbara used to say that managing a software group was like herding a pride of cats.
We thought of the Foundation as a kernel upon which others would layer an actual development environment for users, tailoring it to a UNIX or Smalltalk model as desired. Internally, we called it Grail, as in the quest for, etc. (It seems a Bell Laboratories tradition to mock one's most serious intentions.)
Grail provided for a persistent, semantic-based representation of the program using an object-oriented hierarchy Rob Murray developed and named ALE Within Grail, the traditional compiler was factored into separate executables. The parser built up the ALF representation. Each of the other components (type checking, simplification, and code generation) and any tools,
such as a browser, operated on (and possibly augmented) a centrally stored ALF representation of the program. The Simplifier is the part of the compiler between type checking and code generation. (Bjarne came up with the name Simplifier; it is a phase of the original cfront implementation.)
What does a Simplifier do between type checking and code generation? It transforms the internal program representation. There are three general flavors of transformations required by any object model component:
1. Implementation-dependent transformations. These are implementation-specific aspects and vary across compilers. Under ALF, they involved the transformations of what we called "tentative" nodes.
For example, when the parser sees the expression fct();
it doesn't know if this is (a) an invocation of a function represented or pointed to by tct or (b) the application of an over loaded call operator on a class object fct. By default, the expression is represented as a function call. The Simplifier rewrites and replaces the call subtree when case (b) applies.
2. Language semantics transformations. These include constructor/destructor synthesis and augmentation, memberwise initialization and memberwise copy support, and the insertion within program code of conversion operators, temporaries, and constructor/destructor calls.
3. Code and object model transformations. These include support for virtual functions, virtual base classes and inheritance in general, operators new and delete, arrays of class objects, local static class instances, and the static initialization of global objects with nonconstant expressions. An implementation goal I aimed for in the Simplifier was to provide an Object Model hierarchy in which the object implementation was a virtual interface supporting multiple object models.
These last two categories of transformations form the basis of this book.
Does this mean this book is written for compiler writers? No, absolutely not. It is written by a (former) compiler writer (that's me) for intermediate to advanced C++ programmers (ideally, that's you). The assumption behind this book is that the programmer, by understanding the underlying C++ Object Model, can write programs that are both less error prone and more
efficient.
What Is the C++ Object Model?
There are two aspects to the C++ Object Model:
1. The direct support for object-oriented programming provided within the language
2. The underlying mechanisms by which this support is implemented The language level support is pretty well covered in my C++ Primer and in other books on C++. The second aspect is barely touched on in any current text, with the exception of brief discussions within [ELLIS90] and
[STROUP94]. It is this second aspect of the C++ Object Model that is the primary focus of this book. (In that sense, I consider this text to form a bookend to my C++ Primer, much as my MFA and MS degrees provide a "fearful symmetry" to my education.) The language covered within the text is the draft Standard C++ as of the winter 1995 meeting of the committee. (Except for some minor details, this should reflect the final form of the language.)The first aspect of the C++ Object Model is invariant. For example, under C++ the complete set of virtual functions available to a class is fixed at compile time; the programmer cannot add to or replace a member of that
What was the Foundation project? Under Bjarne's leadership, a small group of us within Bell Laboratories was exploring solutions to the problems of large-scale programming using C++. The Foundation was an effort to define a new development model for the construction of large systems
(again, using C++ only; we weren't providing a multilingual solution). It was an exciting project, both for the work we were doing and for the people doing the work: Bjarne, Andy Koenig, Rob Murray, Martin Carroll, Judy Ward, Steve Buroff, Peter Juhl, and myself. Barbara Moo was supervising the gang of us other than Bjarne and Andy. Barbara used to say that managing a software group was like herding a pride of cats.
We thought of the Foundation as a kernel upon which others would layer an actual development environment for users, tailoring it to a UNIX or Smalltalk model as desired. Internally, we called it Grail, as in the quest for, etc. (It seems a Bell Laboratories tradition to mock one's most serious intentions.)
Grail provided for a persistent, semantic-based representation of the program using an object-oriented hierarchy Rob Murray developed and named ALE Within Grail, the traditional compiler was factored into separate executables. The parser built up the ALF representation. Each of the other components (type checking, simplification, and code generation) and any tools,
such as a browser, operated on (and possibly augmented) a centrally stored ALF representation of the program. The Simplifier is the part of the compiler between type checking and code generation. (Bjarne came up with the name Simplifier; it is a phase of the original cfront implementation.)
What does a Simplifier do between type checking and code generation? It transforms the internal program representation. There are three general flavors of transformations required by any object model component:
1. Implementation-dependent transformations. These are implementation-specific aspects and vary across compilers. Under ALF, they involved the transformations of what we called "tentative" nodes.
For example, when the parser sees the expression fct();
it doesn't know if this is (a) an invocation of a function represented or pointed to by tct or (b) the application of an over loaded call operator on a class object fct. By default, the expression is represented as a function call. The Simplifier rewrites and replaces the call subtree when case (b) applies.
2. Language semantics transformations. These include constructor/destructor synthesis and augmentation, memberwise initialization and memberwise copy support, and the insertion within program code of conversion operators, temporaries, and constructor/destructor calls.
3. Code and object model transformations. These include support for virtual functions, virtual base classes and inheritance in general, operators new and delete, arrays of class objects, local static class instances, and the static initialization of global objects with nonconstant expressions. An implementation goal I aimed for in the Simplifier was to provide an Object Model hierarchy in which the object implementation was a virtual interface supporting multiple object models.
These last two categories of transformations form the basis of this book.
Does this mean this book is written for compiler writers? No, absolutely not. It is written by a (former) compiler writer (that's me) for intermediate to advanced C++ programmers (ideally, that's you). The assumption behind this book is that the programmer, by understanding the underlying C++ Object Model, can write programs that are both less error prone and more
efficient.
What Is the C++ Object Model?
There are two aspects to the C++ Object Model:
1. The direct support for object-oriented programming provided within the language
2. The underlying mechanisms by which this support is implemented The language level support is pretty well covered in my C++ Primer and in other books on C++. The second aspect is barely touched on in any current text, with the exception of brief discussions within [ELLIS90] and
[STROUP94]. It is this second aspect of the C++ Object Model that is the primary focus of this book. (In that sense, I consider this text to form a bookend to my C++ Primer, much as my MFA and MS degrees provide a "fearful symmetry" to my education.) The language covered within the text is the draft Standard C++ as of the winter 1995 meeting of the committee. (Except for some minor details, this should reflect the final form of the language.)The first aspect of the C++ Object Model is invariant. For example, under C++ the complete set of virtual functions available to a class is fixed at compile time; the programmer cannot add to or replace a member of that
相关资源回到顶部↑
· 【推荐】众多高校学子口口相传,他们共同的选择--华清远见嵌入式学院(嵌入式Linux就业课程、3G手机开发就业课程,通过入学测试即签100%就业协议,4个月集中实训,世界500强企业成功就业保障!!!)· 【亚嵌教育 嵌入式培训专家】(嵌入式培训,嵌入式Linux培训,ARM培训,Linux培训,3G培训,Android培训,WINCE培训,DSP培训,FPGA培训,嵌入式就业培训)
· 程序员的7种武器(正则表达式、编程语言、数据库、算法、软件调试、开发环境)
· C/C++ 经典著作(《C专家编程》《C++ Templates中文版》《C和指针 》《C陷阱与缺陷》《C++沉思录》)
评论交流
共有22人开贴评论 46人参与评论 19人参与打分 查看
该作者发表于:2009-12-23 11:29:00
没有问题,好的书,值得用心读。书中介绍了C++对象模型的编译实现方式。在看这本书之前,我以为C ++ 编译器和C编译器一样,直接将C++内容编译成汇编语言,再进一步编译链接成本地机器码。现在想来,以前的思维有些僵化,程序设计语言编译链接的最终目标是生成能够在本地运行的机器码(或是虚拟机字节码),过程中可能产生多种不同的过渡语言文件,C++编译就可能经历C、汇编两个阶段,过渡阶段越多可能造成越多的编译开销,但也能充分利用已有的程序设计资源,提高编译效率。归根结底,就像本书那样,需要通过实验来证明一项技术或一个想法的实际效果
| 我要写评论 |
| 查看所有评论交流(共22条) |








点击看大图





加载中...

