by Stanley B. Lippman
ISBN: 0201834545
Buy from O’Reilly
Found in 2 comments on Hacker News
twoodfin · 2020-07-19 · Original thread
This is exactly how C++ structures single-inheritance types without virtual member functions.

Supporting virtual member functions (i.e. runtime polymorphism) only requires adding a vtable pointer—which IIRC Linux also does for some of its own structural subtyping, at least in its Virtual File System component.

Multiple inheritance requires some more bookkeeping by the compiler of appropriate offsets, but structurally it doesn't change very much.

It's not surprising: C++ was famously originally implemented as a preprocess transformation into C. Inside the C++ Object Model[1] is a fascinating deep dive on how C++ semantics map to C constructs.

[1] https://www.oreilly.com/library/view/inside-the-c/0201834545...

twoodfin · 2013-11-25 · Original thread
Much of C++ made more sense to me when I read Inside the C++ Object Model by Stanley Lippman[1]. It helped me internalize the fact that C++ was originally implemented as a preprocessor transformation into C (Stroustrup's Cfront). Thus many C++ mechanisms can be understood as elaborate syntactic sugar.

[1] http://www.amazon.com/Inside-Object-Model-Stanley-Lippman/dp...