This is the mail archive of the 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: Idea of feature/optimization for C++

> -----Original Message-----
> From: gcc-owner  On Behalf Of staube
> Sent: 01 September 2004 10:30

> I am writing this mail in order to propose and new 
> optimization/feature in the
> C++ front end of GCC.

> 3) Who knows?, maybe the feature is already implemented, so, 
> i am not adding
> anything :-(
> The issue i want to cover is virtual functions and 
> late/early-binding. 

> As you see both examples do the same thing, only that the 
> second one uses Early
> Binding and then is more efficient.

> functions whenever possible  Í was thinking that if the 
> compiler would be
> inteligent enought it could do early binding in the first 
> example too, because
> theres no need to do late-binding.

  It is indeed an excellent idea, and your presentation of the idea and
analysis of the benefits of this optimisation were spot on, but it has
already been done; at least to some extent.

> Another optimization: inline and virtual!!!
> A method could be declared at the same time inline and 
> virtual. then when a
> function call that method using earlybinding it will inline 
> the function, but
> in the latebinding version it would call the method in the 
> standard way.

  That too is done, in the cases where the compiler can deduce the binding
at compile time and where the function body has already been seen and was
defined directly in the class declaration or has the inline attribute
applied to it.

Can't think of a witty .sigline today....

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