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,36c55584044f4f0f X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-12-07 18:25:46 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!canoe.uoregon.edu!arclight.uoregon.edu!wn13feed!wn11feed!worldnet.att.net!207.217.77.102!newsfeed2.earthlink.net!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!newsread1.prod.itd.earthlink.net.POSTED!not-for-mail Message-ID: <3DF2AD96.6010100@acm.org> From: Jeffrey Carter User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.0.0) Gecko/20020530 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: string manipulation References: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Date: Sun, 08 Dec 2002 02:24:39 GMT NNTP-Posting-Host: 63.184.105.66 X-Complaints-To: abuse@earthlink.net X-Trace: newsread1.prod.itd.earthlink.net 1039314279 63.184.105.66 (Sat, 07 Dec 2002 18:24:39 PST) NNTP-Posting-Date: Sat, 07 Dec 2002 18:24:39 PST Organization: EarthLink Inc. -- http://www.EarthLink.net Xref: archiver1.google.com comp.lang.ada:31545 Date: 2002-12-08T02:24:39+00:00 List-Id: Gep wrote: > > while not valid > loop > get_line(V_string, V_length); > > if V_length= V_string'length then > Skip_Line; > Valid := True; > else > valid :=false; > Put("invalid"); > end if; > end loop; This looks better then that other code. You can do this. It will repeatedly get a line until it gets one that is exactly V_String'Length characters. If that's what you want. I don't see what it has to do with declaring a string variable of a specific length. Valid is sort of useless here, as well as providing an opportunity for errors. You can forget to assign to it, or assign the wrong value. I think this would read better without it: loop Get_Line (...); if V_Length = V_String'Length then Skip_Line; exit; end if; Put ("invalid"); end loop; The purpose of the code is to exit the loop when a line of the right length is read. It's better for the code to say that, then to hide it behind a Boolean flag. -- Jeff Carter "Pray that there's intelligent life somewhere up in space, 'cause there's bugger all down here on earth." Monty Python's Meaning of Life