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,5355421156b0daa1 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-08-09 02:34:01 PST From: Stewart Newsgroups: comp.lang.ada Subject: Re: Data_Error - Where in this code? Date: Thu, 09 Aug 2001 10:34:46 +0100 Message-ID: References: <1qstmt4hiaiutibe0jies4j0v04ll7mahs@4ax.com> <3B7139C8.36D68A1D@raytheon.com> X-Newsreader: Forte Agent 1.8/32.548 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: host213-123-60-148.dialup.lineone.co.uk X-Trace: 9 Aug 2001 10:33:59 +0100, host213-123-60-148.dialup.lineone.co.uk Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!dispose.news.demon.net!demon!mk-nntp-1.news.uk.worldonline.com!host213-123-60-148.dialup.lineone.co.uk Xref: archiver1.google.com comp.lang.ada:11673 Date: 2001-08-09T10:34:46+01:00 List-Id: On Wed, 08 Aug 2001 08:08:24 -0500, Mark Johnson wrote: >Stewart wrote: > >> On Mon, 06 Aug 2001 20:47:41 +0100, Stewart >> wrote: >> Hi, >> >And as such - Max_Size cannot be used in an expression prior to its >initialization. The line... > > Input : String (1 .. Max_Size); >is such an expression. It requires the compiler to allocate "Max_Size" bytes of >storage for the "Input" string. Let's say the Ada runtime gave you a default >value of zero (0) for Max_Size - the statement above be equivalent to... > > Input : String (1 .. 0); The problem appears to have gone away when I glued fileload and menu together. I moved the package definitions and the Max_Size : Positive; to the main procedure definition area. > >Why not use... > Max_Size : Positive := 80; -- make it longer than any expected input line >instead. Text_IO.Get_Line will read up to 80 characters from the input line & set >Max_Size to the number of characters read. I tried this and the exception operated for the number I allocated to Max_Size. >The rest of the code is pretty user hostile, but "should work" as you expect. > --Mark Can I ask what you mean by user hostile? I am using Skansholm's "Ada 95 from the beginning" as my learner's bible. any other advice gratefully received. Stewart