This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFC: New C++ Attribute: final


On Mar  2, 2004, Daniel Berlin <dberlin@dberlin.org> wrote:

>> Certainly not.  But if such a pointer to member was final and bound to
>> a known function, GCC might be able to short-curcuit function calls
>> through it, and even inline them.  But since, for a virtual function,
>> it is not possible to know the exact function that is going to be
>> called unless you happen to know the dynamic type of the object, you
>> lose.  With final, you'd win.

> Compilers besides GCC have started to get good at determining the
> dynamic types of objects and "devirtualizing calls".

Sure, but that's besides the point.  In the case at hand, the object
*may* have a derived type that overrides the member function, but the
other member function actually wanted the non-overridden function to
be called.  There's no way to express this in C++ other than
introducing another function, member or friend, that calls the
function using a qualified name.

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Happy GNU Year!                     oliva@{lsd.ic.unicamp.br, gnu.org}
Red Hat GCC Developer                 aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist                Professional serial bug killer


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]