From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id LAA14411; Thu, 8 Jul 2004 11:51:16 +0200 (MET DST) Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id LAA14120 for ; Thu, 8 Jul 2004 11:51:15 +0200 (MET DST) Received: from eris.rz.uni-saarland.de (eris.rz.uni-saarland.de [134.96.7.8]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i689pEEV027910 for ; Thu, 8 Jul 2004 11:51:14 +0200 Received: from cs.uni-sb.de (cs.uni-sb.de [134.96.254.254]) by eris.rz.uni-saarland.de (SGI-8.12.5/8.12.10) with ESMTP id i689pDCS2381941 for ; Thu, 8 Jul 2004 11:51:13 +0200 (CST) Received: from mail.cs.uni-sb.de (mail.cs.uni-sb.de [134.96.254.200]) by cs.uni-sb.de (8.13.0/2004062200) with ESMTP id i689pCad004494 for ; Thu, 8 Jul 2004 11:51:12 +0200 (CEST) Received: from ps.uni-sb.de (grizzly.ps.uni-sb.de [134.96.186.68]) by mail.cs.uni-sb.de (8.13.0/2004062200) with ESMTP id i689pBN5001364 for ; Thu, 8 Jul 2004 11:51:11 +0200 (CEST) X-Authentication-Warning: email: Host grizzly.ps.uni-sb.de [134.96.186.68] claimed to be ps.uni-sb.de Received: from ps.uni-sb.de (groove.ps.uni-sb.de [134.96.186.172]) by ps.uni-sb.de (8.12.10/8.12.10) with ESMTP id i689pATe025189; Thu, 8 Jul 2004 11:51:10 +0200 Message-ID: <40ED190E.3080005@ps.uni-sb.de> Date: Thu, 08 Jul 2004 11:51:10 +0200 From: Andreas Rossberg User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.1) Gecko/20031114 X-Accept-Language: en-us, en MIME-Version: 1.0 To: caml-list Subject: Re: [Caml-list] Does Caml have slow arithmetics ? References: <20040707091308.GA26172@bourg.inria.fr> <20040707145803.GB27498@yquem.inria.fr> <1089227778.29648.81.camel@pelican.wigram> <20040708034455.GB29942@davidb.org> In-Reply-To: <20040708034455.GB29942@davidb.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-1.5.1 (eris.rz.uni-saarland.de [134.96.7.8]); Thu, 08 Jul 2004 11:51:13 +0200 (CEST) X-AntiVirus: checked by AntiVir Milter 1.0.6; AVE 6.26.0.3; VDF 6.26.0.19 X-Miltered: at nez-perce with ID 40ED1912.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; rossberg:01 rossberg:01 uni-sb:01 caml-list:01 arithmetics:01 recursion:01 implemented:01 gcc:01 recursion:01 gcc:01 pointers:01 uni-sb:01 compiler:01 semantics:01 caml:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk David Brown wrote: > > In some functional languages (Scheme, specifically), tail recursion is > required to be implemented iteratively. It is a common enough idiom, > and easy enough to implement, that it is generally done in functional > languages. In fact, gcc does it in C, with enough optimization. The latter is, to a certain extent, a myth. First, you have to distinguish between simple tail *recursion*, and the much more general concept of tail *call*. I believe Scheme requires to fully optimize the latter, and so it is done by all decent FPL implementations. GCC does not do that, already falling short of mutually recursive functions, IIRC. Second, a C compiler can only optimize tail recursion under limited circumstances, because generally the C language semantics prevent it (once more due to pointers, particularly C allowing - and its libraries relying on - taking the address of local variables). Last time I heard of it, it was said that GCC is having a hard time doing anything practically usefull at all. - Andreas -- Andreas Rossberg, rossberg@ps.uni-sb.de Let's get rid of those possible thingies! -- TB ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners