C++ / a working model

BOOK / SOURCE & READING RECORD

Inside the C++ Object Model

Stanley B. Lippman

1996 first edition, ISBN 9780201834543; public 2003 HTML-to-PDF reflow has 182 PDF pages, not original print pagination

READING EVIDENCE / Full text read

Inside the C++ Object Model

The entire body text, code, footnotes, and tables of all 7 chapters of the public 182-page reflowed edition have been read paragraph by paragraph: Chapter 1 PDF pp. 12–31, Chapter 2 pp. 31–54, Chapter 3 pp. 54–82, Chapter 4 pp. 82–111, Chapter 5 pp. 111–137, Chapter 6 pp. 137–160, Chapter 7 pp. 160–182; all 17 numbered figures (subfigures counted separately) have been viewed directly, including the last Figure 4.3 / PDF p. 100. “full” refers only to all substantial chapters of this file; it does not claim page-by-page collation of the 304-page print edition or that the print index not included in this file has been read. PDF page numbers are not print page numbers.

Edition, actual reading range, and original sources →

Sources

Behavioral boundaries during construction matter more than vtable diagrams

Chapter 5 §5.2, The Semantics of the vptr Initialization; reflow PDF pp.124–127

When analyzing constructors, the most useful observation is not remembering how many slots a given vtable has, but confirming which objects have already been established. During base-class construction one cannot rely on as-yet-uninitialized derived state; even when a virtual function is called indirectly via a helper member, the override selected is still the one that corresponds to the current construction phase. The book uses stepwise vptr assignment to illustrate one implementation path, whereas portable programs need only rely on call semantics. A modern course can record return values at the three moments of construction, ordinary call, and destruction to verify the boundaries, without reading or writing interior object bytes and without treating cfront’s hidden-parameter form as an interface compilers must obey.

Keep historical cost models separate from modern correctness

Chapter 5 §§5.4–5.5, reflow PDF pp.131–137; Chapter 6 §6.2, reflow PDF pp.145–154

This book reduces implicit construction, member copying, inheritance layout, virtual calls, and exception cleanup to implementation steps, which is well suited to training awareness of hidden work, yet one cannot promote the measurements of that era directly into today’s performance conclusions. Assembly differences on cfront and SGI are first of all specific experimental results; vtable location, member-pointer representation, and array-management information are not a unified ABI. More importantly, examples from the old book still need review against modern rules: array new must be paired with array delete; one must not delete array elements one by one; deleting a derived object through an ordinary base-class pointer requires a virtual destructor. Keep the problem awareness rather than treating early code as a safe template.

Related fundamentals

Construction and destruction orderVtables: Language Semantics and ABI ImplementationBase destructor: public virtual or protected nonvirtualStatic and Dynamic Polymorphism, Slicing, and RTTI

Original practice →