This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: RFC: New C++ Attribute: final
On Mar 2, 2004, Gabriel Dos Reis <gdr@integrable-solutions.net> wrote:
> Taking a pointer-to-member is a very *general* mechanism, that comes
> with its price. And in pratice, it is far more efficient (whether the
> member function is virtual or not is immaterial) just to use custom
> function objects that directly call the function: You get far *better*
> efficiency.
But then you can't use a generic template class to implement this
object, which makes it far more cumbersome.
> When you create a pointer to member function, the member
> function does not need to be virtual
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.
> People keep damaging codes -- in the name of whatever (usually,
> generality). I believe people who damage their codes get what they
> deserve :-)
> With the help of final or not, people are going to damage their codes
> anyway :-)
So what do you propose? Not to use C++? Not to use any programming
language? :-) :-)
--
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