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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: "Jeffrey R. Carter" Newsgroups: comp.lang.ada Subject: Re: Introductory Presentations, especially aimed at C++ programmers! Date: Tue, 13 Dec 2016 15:05:10 -0700 Organization: Also freenews.netfront.net; news.tornevall.net; news.eternal-september.org Message-ID: References: <1905815374.502825168.454102.laguest-archeia.com@nntp.aioe.org> <877f7b5llo.fsf@nightsong.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Tue, 13 Dec 2016 22:03:50 -0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="157c8266453fd1657f78090be7465af6"; logging-data="15964"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19XEj8fokX+to2LXKinwX8c1Dhbi5ug3XE=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 In-Reply-To: Cancel-Lock: sha1:EmkdS2ITS4oSpKZ5CnDsqsJKO0c= Xref: news.eternal-september.org comp.lang.ada:32790 Date: 2016-12-13T15:05:10-07:00 List-Id: On 12/13/2016 02:15 PM, Robert A Duff wrote: > > That's how it's done in GNAT. How is it done in "most versions"? Yes, but the GNAT implementation is rather poor. A better way doesn't need to copy anything: function Get_Line return String is Buffer : String (1 .. 1_000); Last : Natural; begin -- Get_Line Get_Line (Item => Buffer, Last => Last); if Last < Buffer'Last then return Buffer (1 .. Last); end if; return Buffer & Get_Line; end Get_Line; -- Jeff Carter "Apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, the fresh water system, and public health, what have the Romans ever done for us?" Monty Python's Life of Brian 80