public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Dave Korn" <dk@artimi.com>
To: <staube@t2.technion.ac.il>, <gcc@gcc.gnu.org>
Subject: RE: Idea of feature/optimization for C++
Date: Wed, 01 Sep 2004 13:43:00 -0000	[thread overview]
Message-ID: <NUTMEGGSQb0SulnJ2IK0000107a@NUTMEG.CAM.ARTIMI.COM> (raw)
In-Reply-To: <1094030972.4135967cb856e@webmail.technion.ac.il>

> -----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  &#205; 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. 

http://www.google.com/search?hl=en&lr=&ie=UTF-8&q=binding+compile-time+resol
ution+virtual+function+c%2B%2B

  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.

    cheers, 
      DaveK
-- 
Can't think of a witty .sigline today....

  reply	other threads:[~2004-09-01 13:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-01  9:29 staube
2004-09-01 13:43 ` Dave Korn [this message]
2004-09-05 23:22   ` staube

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=NUTMEGGSQb0SulnJ2IK0000107a@NUTMEG.CAM.ARTIMI.COM \
    --to=dk@artimi.com \
    --cc=gcc@gcc.gnu.org \
    --cc=staube@t2.technion.ac.il \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).