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


> Every problem in computer science can be solved by an extra level of
> indirection.  Or rather, every problem other than inadequate
> performance. Such claims usually come from those who follow rigid
> ideological approaches to object-oriented design.

Speaking from the perspective of a developer that writes a lot of C++
code, I totally agree with your viewpoint.  There _are_ workarounds that
don't cause code duplication (in the derived class, have a non-virtual
method do the work, and have the virtual one just call it), but these are
really gross and seemingly against the spirit of C++.

Also, it's not feasible to make all of the clients know about this
distinction, and if it changes over time, it's not scalable to modify tons
of client code where we could just modify one declaration in the header.
Also, if the client code is really a template using std::mem_fun or
something, it's not *possible* to change the client (without even more
gross hacks I suppose).

In my situation, I have complete control over the class hierarchy and if a
new subclass needs to be added, it's ok to remove the attribute and force
clients to recompile.  Though not everyone is in this situation, many are,
and it seems very reasonable to support it directly: even as a GCC
extension.

-Chris

-- 
http://llvm.cs.uiuc.edu/
http://www.nondot.org/~sabre/Projects/


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