The following section presents the rules for constructing compact dispatch headers for the bidirectional layout. The goal of these rules is to generate compact layouts for classes that are part of typical hierarchies. No object layout scheme can generate minimal layouts without global knowledge of the hierarchy, but as these rules demonstrate, it is possible to do very well with only local information so long as the class hierarchy conforms to expectations. Even when it does not, these rules do as well as or better than rules used by current C++ compilers.
Existing C++ compilers do not handle the hierarchy of Figure 1 well. For each level of inheritance, they add an additional word of dispatch information, making multiple inheritance an inefficient way to separate interfaces and implementations. Alternative techniques for separating inheritance and subtyping are also hampered by extra overhead. By contrast, the rules in this paper handle hierarchies of this form with only a single word of dispatch information. More complicated hierarchies involving multiple supertypes may require more dispatch vectors for some classes, but the rules here are never less efficient than currently used schemes.