Path: utzoo!utgpu!water!watmath!clyde!rutgers!mit-eddie!uw-beaver!tektronix!sequent!mntgfx!archiel From: archiel@mntgfx.mentor.com (Archie Lachner) Newsgroups: comp.lang.c++ Subject: Re: const, reference "this" revisited ??? Message-ID: <1988Feb9.101643.2495@mntgfx.mentor.com> Date: 9 Feb 88 18:16:40 GMT References: <6590015@hplsla.HP.COM> Organization: Mentor Graphics Corporation, Beaverton Oregon Lines: 26 in article <6590015@hplsla.HP.COM>, jima@hplsla.HP.COM ( Jim Adcock) says: > > 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. Efficiency issues aside, it would be nice to have some mechanism by which one could specify which member functions were legal for use with constant objects and which were legal only for non-constants. For example, it is not now currently possible to specify that the member function "operator=()" should not be applied to constants. The mechanism of optionally specifying "this" as an argument to a member function could conceivably be used to solve this problem. -- Archie Lachner Mentor Graphics Corporation Beaverton, Oregon ...!{decwrl,sequent,tessi}!mntgfx!archiel