Path: utzoo!mnetor!uunet!husc6!mit-eddie!uw-beaver!tikal!hplsla!jima From: jima@hplsla.HP.COM ( Jim Adcock) Newsgroups: comp.lang.c++ Subject: Re: const, reference "this" revisited ??? Message-ID: <6590015@hplsla.HP.COM> Date: 1 Feb 88 22:29:43 GMT References: <6590014@hplsla.HP.COM> Organization: HP Lake Stevens, WA Lines: 21 In response to the vast amount of excitment this note has generated, let me say I am tending to rethink this subject. Per conversations with MTD and Glen Purdy here, it should be possible to use a variety of register passing schemes for "this' and the "vtable" pointer that will avoid most inefficiencies, even if the called routine is unable to declare (this*) const or not. Ideally, this, and this->vtable are passed to the called (virtual) routine using a register passing scheme. The called routine knows whether vtable gets poisoned by an assignment to (this*) and can update vtable accordingly before it exits. PS: If you are a c++ compiler writer, I sure would lobby for the idea of passing "this" and "this->vtable" using a register passing scheme. This would not invalidate existing C libraries using a stack passing scheme for "normal" variables, since C++ "this" and "this->vtable" are NOT "normal" variables, nor do they have an equivalent in normal C code. I guess this "this" register passing scheme could even be faked-up in cfront if anyone were so motivated.