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 Mon, 1 Mar 2004, Nathan Sidwell wrote:
> Jeff Sturm wrote:
> > If a base class declares a method 'virtual' in C++, can a derived class
> > override the modifier, such that calls to the overridden method do
> > not require vtable dispatch?
> Only when the dynamic type can be determined at compile time.

I see...

>  From a programmer's perspective, why is it desirable to remove the
> virtuality?

For C++, I can't think of a good reason besides performance.  In Java, I
think 'final' is essential to the security framework.

In practice we often use 'final' to trigger a compilation error if someone
tries to override a method we wouldn't normally expect to be overridden,
if only to force the developer to examine it closely.  However the first
time someone removes the final modifier, we lose that benefit.

Jeff


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