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


Alexandre Oliva <aoliva@redhat.com> writes:

| 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.

Like a local class?  ;-)

| 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.

Yes, but we need to (1) audit how good we already are at issue the
"final" semantics implied current situations (we're near zero)
(2) how much of type information do we use (we're near zero, but I
hope the situation will get better with tree-ssa).  
And we're shouting for a new keyword.  Before you call me a rigid guru,
please try to understand that

  (1) I'm not anti- nor pro- final, at this stage;
  (2) understand the other factors and points.

-- Gaby
 


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