From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,a00006d3c4735d70 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-02-05 06:54:04 PST Path: archiver1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!crtntx1-snh1.gtei.net!news.gtei.net!newsfeed1.easynews.com!easynews.com!easynews!border1.nntp.sjc.giganews.com!nntp.giganews.com!local1.nntp.sjc.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail NNTP-Posting-Date: Thu, 05 Feb 2004 08:54:00 -0600 Date: Thu, 05 Feb 2004 09:53:59 -0500 From: "Robert I. Eachus" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: In-Out Parameters for functions References: <1075390647.405841@master.nyc.kbcfp.com> <1075405582.982776@master.nyc.kbcfp.com> <1075482385.142744@master.nyc.kbcfp.com> <1075732402.294581@master.nyc.kbcfp.com> <1075741279.952497@master.nyc.kbcfp.com> <16nu1099ekujjbpe9dqvs3noi9sdcfja6e@4ax.com> <1075817212.745748@master.nyc.kbcfp.com> <1075824683.769215@master.nyc.kbcfp.com> <1075851506.238480@master.nyc.kbcfp.com> <4020C947.81A6D703@0.0> <1075907239.138068@master.nyc.kbcfp.com> <402232E9.3EE15B4B@0.0> <1075987360.225622@master.nyc.kbcfp.com> In-Reply-To: <1075987360.225622@master.nyc.kbcfp.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: NNTP-Posting-Host: 24.147.77.160 X-Trace: sv3-PYPHhm8ploenz6n7qvxq9MrPFVW8bUsEU4FAnbvG+jfw0yhBXI1yWk7spsjoW+i6h1paHjAPbkkMeeN!TZKAwG3ZifE2EceEFeorhPDrV+saMpJj/gKnCAWR+QxCKHxmUYHMbU+sz9ZKzg== X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Xref: archiver1.google.com comp.lang.ada:5252 Date: 2004-02-05T09:53:59-05:00 List-Id: Hyman Rosen wrote: > But you are now talking about finding an optimal implementation > order for an expression involving more than one function call > where the compiler has no access to the body of the functions. > Do you really think that allowing the compiler to pick the order > of the calls will significantly affect the efficiency? Of course it will. Consider for one example a Pure subprogram, say a call to Sin or Log from a math package inside a loop. The pragma Pure rules allow the compiler to hoist the call outside the loop, if the parameter(s) are unchanged in successive calls. YOU may think that is a contrived example, but it is not. That sort of thing happens all the time in embedded flight dynamics systems where a set of expressions is iterated a couple of times for convergence. And even if the expressions are not iterated, they often include common subexpressions that can be pulled out of line by the compiler. Any call to a Pure function can be treated as a common subexpression, even if the subprogram itself is not inlined. This is one of the nice features of Ada for safety-critical systems. The formulas for things like flight dynamics can be almost copied verbatum from the specification, and the compiler (and Verifier!) can do the grody work of finding an efficient implementation and showing that it is equivalent. -- Robert I. Eachus "The war on terror is a different kind of war, waged capture by capture, cell by cell, and victory by victory. Our security is assured by our perseverance and by our sure belief in the success of liberty." -- George W. Bush