Inside the C++ Object Model

Stanley B. Lippman

出版时间

1996-05-13

ISBN

9780201834543

评分

★★★★★
书籍介绍

Inside the C++ Object Model focuses on the underlying mechanisms that support object-oriented programming within C++: constructor semantics, temporary generation, support for encapsulation, inheritance, and "the virtuals"--virtual functions and virtual inheritance. This book shows how your understanding the underlying implementation models can help you code more efficiently and with greater confidence. Lippman dispells the misinformation and myths about the overhead and complexity associated with C++, while pointing out areas in which costs and trade offs, sometimes hidden, do exist. He then explains how the various implementation models arose, points out areas in which they are likely to evolve, and why they are what they are. He covers the semantic implications of the C++ object model and how that model affects your programs. Highlights *Explores the program behavior implicit in the C++ Object Model's support of object-oriented programming. *Explains the basic implementation of the object-oriented features and the trade offs implicit in those features. *Examines the impact on performance in terms of program transformation.* Provides abundant program examples, diagrams, and performance measurements to relate object-oriented concepts to the underlying object model. If you are a C++ programmer who desires a fuller understanding of what is going on "under the hood," then Inside the C++ Object Model is for you! Get a value-added service! Try out all the examples from this book at www.codesaw.com. CodeSaw is a free online learning tool that allows you to experiment with live code from your book right in your browser. 0201834545B11102003

Stanley B. Lippman的工作是提供关于C++和面向对象的训练、咨询、设计和指导。Lippman在成为一名独立咨询顾问之前,曾经是迪士尼动化公司的首席软件设计师。他在AT&T Bell实验室的时候,领导了cfront 3.0版本和2.1版本的编译器开发组。他也是Bjarne Stroustrup领导的Bell实验室Foundation项目的成员之一,负责C++程序设计环境中的对象模型部分。Lippman还撰写了许多关于C++的论文。目前Lippman已受雇于微软公司,负责Visual C++项目。

译者侯捷:电脑技术自由作家,对于技术的钻研和发表,有独特的品性与坚持。作品涵盖著、译、评三方面,散见于各种刊特、媒体、网站论坛。

AI导读
核心看点
  • 深入剖析C++对象底层实现机制
  • 详解构造函数、虚函数与继承模型
  • 揭示C++性能开销与编译原理
适合谁读
  • 希望深入理解C++底层原理的开发者
  • 具备C++基础并欲进阶的高级程序员
  • 对编译器实现及内存模型感兴趣的读者
读前提醒
  • 需扎实计算机基础,阅读过程较烧脑
  • 基于C++98标准,部分细节已过时
  • 建议结合侯捷译本及现代标准对照阅读
读者共识
  • C++底层机理讲解透彻,经典必读
  • 读完对虚表、临时对象等概念豁然开朗
  • 内容晦涩但逻辑清晰,适合反复研读

本导读基于书籍简介、目录、原文摘录、短评和书评生成,不等同于全文精读。

精彩摘录
  • "在这四种情况中,程序可以被正确编译并执行,但是效率不彰。"
  • "You mustuse the member initialization list in the following cases in order for your program to compile 1. When initializing a reference member 2. When initializing a const member 3. When invoking a base or member class constructor with a set of arguments In the fourth case, the program compiles and "
  • "1. b[i] + c[i] 对应一个 2. b[i] * c[i] 对应一个 3. 上述两个临时对象的相减结果需要一个来存放 4. 两个临时对象,分别用来放置上述第一个临时对象和第二个临时对象,为的是完成第三个临时对象"
  • "RIIT 就是为了 EH (Exception Handling) 的副产物"
  • "然而如果企图以一个RedPanda object作为little_critter的初值,编译器必须判断“后续当程序员企图存取其ZooAnimal subobject时是否能够正确地执行”(这是一个理性的程序员所期望的)"
  • "foobar()函数中的L5,有个 Point object local,同样也是既没有被构造也没有被析构。当然啦,Point object local如果没有先经过初始化,可能会成为一个潜在的程序“臭虫”——万一第一次使用它就需要其初值的话(像L7)。至于 heap object在L6的初始化操作: 6)Point * heap = new Point; 会被转为对new运算符(由library提供)的调用: Point *heap = __new( sizeof( Point ) ); 再一次强调一下,并没有 default constructor施行于new运算符所传过的Point身上。"
用户评论
看完还是有点混,还是得结合实践
深入C++的好书
了解C++对象内存模型的唯一书籍!必读。
in-depth C++
对EH解释得不甚了了 类内部的数据结构 过程结构 倒是很详细 Lipmann的语言功力不错 他的书浅显易懂 读完对C++的理解深了一些
96年的老书,PDF也就180页,但内容独一档,且变化不大(真耐久啊,像NRVO那时就有了),作者还写了大名鼎鼎(一直避而未读的)C++ Primer! (2023年尾)总被面到的一个经典问题是CRTP取代vptr,涉及到template、virtual mechanism的方方面面,浅看油管能答对的有限,问到不会不懂后,面试官推荐了此书,全面深刻,知其然且知其所以然,透彻!
我看完了一遍, 又忘了这本书说的啥了,很难形成一个整体印象
过时了
看完《primer》之后,没那么难理解,很多例子都有那种熟悉的感觉(eg. cin<<) C++对象模型中关于虚函数内存如何分配的,记得面试常考。
扎实基础的好书
下载
收藏