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,345a8b767542016e X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-03-18 11:54:08 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!colt.net!dispose.news.demon.net!demon!news2.euro.net!uunet!ash.uu.net!spool0900.news.uu.net!reader0900.news.uu.net!not-for-mail Message-ID: <3C9645DD.4020006@mail.com> Date: Mon, 18 Mar 2002 14:54:05 -0500 From: Hyman Rosen User-Agent: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:0.9.9) Gecko/20020311 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: memory leakages with Ada? References: <3c90af1e@news.starhub.net.sg> <3c91bfa3.1987537@news.demon.co.uk> <3C9629E3.8030109@home.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Organization: KBC Financial Products Cache-Post-Path: master.nyc.kbcfp.com!unknown@fixedcost.nyc.kbcfp.com X-Cache: nntpcache 2.3.3 (see http://www.nntpcache.org/) NNTP-Posting-Host: 204.253.250.10 X-Trace: 1016481247 reader0.ash.ops.us.uu.net 14925 204.253.250.10 Xref: archiver1.google.com comp.lang.ada:21422 Date: 2002-03-18T14:54:05-05:00 List-Id: Warren W. Gay VE3WWG wrote: > In Ada95, this mundane issue is mundane and easy : > function Uppercase(S : String) return String is > UC : String(1..S'Length) := S; > begin > ...uppercase UC... > return UC; > end Uppercase; > > The caller has equal convenience : > declare > UC : String := Uppercase("Take that!"); > begin > ... > This is so much easier, and most important *reliable*. There are still trade-offs to this approach. It's inapplicable when you need to generate more than a single result, since the technique can't be applied to out parameters or to record members. And it will most likely require an extra copy of the return value, since it's difficult to construct a variable-size array in the callers's frame. But it is very nice.