Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!att!ulysses!andante!alice!bs From: bs@alice.UUCP (Bjarne Stroustrup) Newsgroups: comp.lang.c++ Subject: Re: Efficiency of Multiple Inheritance Summary: alternative implementations Message-ID: <9465@alice.UUCP> Date: 12 Jun 89 13:08:05 GMT References: <1484@bacchus.dec.com> Organization: AT&T Bell Laboratories, Murray Hill NJ Lines: 18 MI can indeed be implemented that way. The technique is often referred to as using `thunks' because a similarity to the technique for inplementing call by name in Algol60. It has the obvious benefit of saving a memory reference and an addition in each virtual function call and a word in every virtual table entry. You don't in general require an extra stack frame (though certain well known computer manufactures does make life difficult), a jump suffices on most architectures. I use the `add a delta' technique in my implementation for portability. I mention the principle of `not requiring a user to pay for what he/she doesn't use' in my paper `Multiple Inheritance for C++' (Proc EUUG conference May 1987, Helsinki and the release notes for release 2.0). I had to chose between the memory reference + addition cost and adding several days to the porting time (from a base of a day or so). I chose portability. Other implementor will have different constrints and goals and may chose differently.