Updated the cast article

Due to popular demand, I've updated the "C++ background: Static, reinterpret and C-Style casts" article. The update clarifies that the compiler may put the virtual function table (if it uses one) where it wants. The only guarantee by the C++ standard is that members inside a single declaration block (public:,private:) will not get reordered. I remember that the fact that C++ does not make any stronger guarantees will enable things like deriving a class from an object which is hosted on a different heap and still have some part on another heap -- for example, having a class which is in part a .NET object and lives on the garbage collected heap and the other part is native and lives on the normal heap. [Update] Found it:

Others had often questioned the use-fulness of C++'s leaving that implementation door open for the future, but the mixed type design -- where parts of the same logical object must be on different physical heaps -- vindicates Bjarne's design judgment.

from Herb Sutter's C++/CLI Rationale, page 18.

Comments

Comments powered by Disqus