From -7792994857944722172
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,e32b36c77828df8b
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 2004-01-05 10:50:50 PST
Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!kibo.news.demon.net!mutlu.news.demon.net!demon!mail2news.demon.co.uk!devnull
From: fjh@cs.mu.OZ.AU (Fergus Henderson)
Newsgroups: comp.std.c++
Subject: Re: Add My Idea to the C++ Compiler
Date: Mon, 5 Jan 2004 18:50:49 +0000 (UTC)
Organization: The University of Melbourne
Lines: 35
Approved: fjh@cs.mu.oz.au (Fergus Henderson , moderator of comp.std.c++)
Message-ID: <3ff9270b$1@news.unimelb.edu.au>
References: <K0uHb.25610$V23.21669@fe1.texas.rr.com>
X-Trace: mail2news.demon.co.uk 1073328649 1250 10.0.0.1 (5 Jan 2004 18:50:49 GMT)
X-Complaints-To: abuse@demon.net
NNTP-Posting-Date: Mon, 5 Jan 2004 18:50:49 +0000 (UTC)
X-Received: from mulga.cs.mu.oz.au ([128.250.1.22])
	by news.demon.co.uk with esmtp (Exim 4.12)
	id 1AdZoN-0000K1-00
	for mail2news@news.news.demon.net; Mon, 05 Jan 2004 18:50:48 +0000
X-Received: from localhost (localhost [[UNIX: localhost]]) by mulga.cs.mu.OZ.AU
	id FAA12293; Tue, 6 Jan 2004 05:50:44 +1100 (EST)
X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f
X-Path: comp-std-cpp-robomod!not-for-mail
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-Delivered-To: std-c++@ucar.edu
X-Newsgroups: comp.std.c++
X-User-Agent: nn/6.6.4
X-Original-NNTP-Posting-Host: jupiter.cs.mu.oz.au
X-Original-Trace: 5 Jan 2004 19:57:47 +1000, jupiter.cs.mu.oz.au
X-Spam-Status: No, hits=-5.7 required=5.0
	tests=AWL,BAYES_10,EMAIL_ATTRIBUTION,QUOTED_EMAIL_TEXT,
	      REFERENCES,REPLY_WITH_QUOTES,USER_AGENT
	version=2.55
X-Spam-Checker-Version: SpamAssassin 2.55 (1.174.2.19-2003-05-19-exp)
Xref: archiver1.google.com comp.std.c++:805

bryan.nospam.parkoff@nospam.com ("Bryan Parkoff") writes:

>    Right now, there is a big problem.  I can't place "inline" into
>pArray_Func[xx]().  I can see why.  JMP can show "JMP [EAX+EDX*4] that will
>work fine.  C/C++ compiler can only place "CALL [EAX+EDX*4] into
>pArrayFunc[xx]().  It is not designed to replace from "CALL [EAX+EDX*4]" to
>"JMP [EAX+EDX*4] if "inline" is there.

I think that on x86 architectures GNU C/C++ versions 3.4 and greater will
generate a JMP instruction for that sort of code .  This is done by what
GCC calls "sibcall optimization", which is an example of what is more
generally known as tail call optimization.

However, it is true that there are some circumstances in which it is difficult
for compilers to perform such optimizations, in particular when the calling
function has local variables whose address has been taken.

For this reason, I proposed an extension to GNU C to allow the user
to tell the compiler when it should perform tail call optimization.
See <http://gcc.gnu.org/ml/gcc/2000-11/msg01120.html> and the thread which
follows, in particular <http://gcc.gnu.org/ml/gcc/2000-11/msg01126.html>.

The language C-- has a similar feature, as does the .NET Intermediate Language.

-- 
Fergus Henderson <fjh@cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]



