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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,386228a37afe967f X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-07-17 13:56:33 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!uio.no!ntnu.no!not-for-mail From: Preben Randhol Newsgroups: comp.lang.ada Subject: Re: Computer Language Shootout Date: Thu, 17 Jul 2003 20:56:33 +0000 (UTC) Organization: Norwegian university of science and technology Message-ID: References: <1ec946d1.0307150715.4ba69f85@posting.google.com> <3F149243.80304@attbi.com> <3F15930C.2070907@attbi.com> NNTP-Posting-Host: kiuk0152.chembio.ntnu.no X-Trace: tyfon.itea.ntnu.no 1058475393 17199 129.241.83.78 (17 Jul 2003 20:56:33 GMT) X-Complaints-To: usenet@itea.ntnu.no NNTP-Posting-Date: Thu, 17 Jul 2003 20:56:33 +0000 (UTC) User-Agent: slrn/0.9.7.4 (Linux) Xref: archiver1.google.com comp.lang.ada:40438 Date: 2003-07-17T20:56:33+00:00 List-Id: Jean-Pierre Rosen wrote: > This one reads a line with no length limit: > > function Get_Line return String is > Buffer : String (1..500); -- or whatever > Last : Natural; > begin > Get_Line (Buffer, Last); > if Last < Buffer'Last then > return Buffer (1..Last); > else > return Buffer & Get_Line; > end if; > end Get_Line; > > In most cases, there will be only one call, while having no upper limit. Hmm, clever! > The size of the buffer is just a matter of optimization. Yes. I guess it is not so smart to set it to say 1..5 as you would call the function recursively a lot :-) -- Ada95 is good for you. http://www.crystalcode.com/codemage/MainMenu/Coding/Ada/IntroducingAda.php