This is the mail archive of the
mailing list for the GCC project.
RE: Idea of feature/optimization for C++
- From: "Dave Korn" <dk at artimi dot com>
- To: <staube at t2 dot technion dot ac dot il>,<gcc at gcc dot gnu dot org>
- Date: Wed, 1 Sep 2004 14:40:57 +0100
- Subject: 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
> 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....