Wednesday, July 11, 2007

BookReview: Inside the C++ Object Model by Stanley Lippman

One of the Best books on C++ internals/under-the-hood.

NOTE: The author was hired by Microsoft as Architect to clean up its extremely non-standard/buggy VC++ compiler to conform to the C++ Standard.

0) The original Cfront preprocessor/compiler converted C++ into C.
That means that almost every C++ code "could" be converted into C.
Note: Modern C++ compilers no longer convert to C, but it helps to make the compilation process more easy to understand. This book connects the dots.
1) Virtual tables/functions turn into simple function pointer table lookups.
Simple data structures show how this is implemented in different compilers.
2) Generated functions like default constructors etc. finally start to make sense.
3) Inheritance starts looking more like compiler controlled composition of objects.
4) Gives you X-Ray vision right from compiler data-structures to actual assembly code.

5) Watch out for the typos and the mismatch between some of the diagrams and the explanation.

You start seeing the source code "through the compiler's eyes". A lot of work from the compiler goes into making your Object-oriented code run.

A Must have book for any person wanting to really know how the compiler works with C++.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.