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, Mar 01, 2004 at 08:48:08PM +0100, Gabriel Dos Reis wrote:
> There is no doubt that people will construct examples where they
> think they need final for C++.

Such code already exists in large amounts, but does not use "final"
because there is no such keyword.

To work around the lack of "final", one of two approaches is taken:

a) favor speed.  In this case, non-virtual methods are used, and it is
   forbidden (by style rules for the project) to override these methods
   or to do derivation in such a way as to break the nonvirtual method.

b) favor safety and extensibility, sacrifice performance.  In this case,
   calls remain virtual although there is no override anywhere.

In case a), addition of "final" would increase robustness, by allowing
the compiler to detect design rule violations.

In case b), addition of "final" would improve performance.


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