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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no 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-08 06:08:26 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!headwall.stanford.edu!feeder.via.net!cyclone-sf.pbi.net!151.164.30.35!cyclone.swbell.net!bos-service1.ext.raytheon.com!dfw-service2.ext.raytheon.com.POSTED!not-for-mail Message-ID: <3B7139C8.36D68A1D@raytheon.com> From: Mark Johnson Reply-To: mark_h_johnson@raytheon.com X-Mailer: Mozilla 4.76 [en] (X11; U; Linux 2.4.2-2smp i686) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Data_Error - Where in this code? References: <1qstmt4hiaiutibe0jies4j0v04ll7mahs@4ax.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Wed, 08 Aug 2001 08:08:24 -0500 NNTP-Posting-Host: 192.27.48.41 X-Complaints-To: news@ext.ray.com X-Trace: dfw-service2.ext.raytheon.com 997276105 192.27.48.41 (Wed, 08 Aug 2001 08:08:25 CDT) NNTP-Posting-Date: Wed, 08 Aug 2001 08:08:25 CDT Organization: Raytheon Company Xref: archiver1.google.com comp.lang.ada:11609 Date: 2001-08-08T08:08:24-05:00 List-Id: Stewart wrote: > On Mon, 06 Aug 2001 20:47:41 +0100, Stewart > wrote: > Hi, > > I still get the Max_Size is not declared, but it is not defined until > the variable for the input is obtained. 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); which I'm pretty sure is not what you wanted.... If you have something like gvd (GNU visual debugger), I suggest stepping through the code to illustrate this concept. 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. The rest of the code is pretty user hostile, but "should work" as you expect. --Mark