From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4641 invoked by alias); 1 Sep 2004 13:43:21 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 4596 invoked from network); 1 Sep 2004 13:43:17 -0000 Received: from unknown (HELO NUTMEG.CAM.ARTIMI.COM) (217.40.111.177) by sourceware.org with SMTP; 1 Sep 2004 13:43:17 -0000 Received: from mace ([192.168.1.25]) by NUTMEG.CAM.ARTIMI.COM with Microsoft SMTPSVC(6.0.3790.0); Wed, 1 Sep 2004 14:40:57 +0100 From: "Dave Korn" To: , Subject: RE: Idea of feature/optimization for C++ Date: Wed, 01 Sep 2004 13:43:00 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit In-Reply-To: <1094030972.4135967cb856e@webmail.technion.ac.il> Message-ID: X-OriginalArrivalTime: 01 Sep 2004 13:40:57.0921 (UTC) FILETIME=[4FBF4310:01C49029] X-SW-Source: 2004-09/txt/msg00038.txt.bz2 > -----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. 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....