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,39ed0c6d1b17bc59 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-07-10 18:59:34 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!elnk-pas-nf2!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!newsread2.prod.itd.earthlink.net.POSTED!not-for-mail Message-ID: <3F0E1A33.5090100@spam.com> From: Jeffrey Carter Organization: jrcarter commercial-at acm [period | full stop] org 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: HELP ! Problems with Get and Put in Generic Procedure References: <9f383bcd.0307101401.60625c77@posting.google.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 11 Jul 2003 01:59:42 GMT NNTP-Posting-Host: 63.184.105.161 X-Complaints-To: abuse@earthlink.net X-Trace: newsread2.prod.itd.earthlink.net 1057888782 63.184.105.161 (Thu, 10 Jul 2003 18:59:42 PDT) NNTP-Posting-Date: Thu, 10 Jul 2003 18:59:42 PDT Xref: archiver1.google.com comp.lang.ada:40184 Date: 2003-07-11T01:59:42+00:00 List-Id: Tanya wrote: R. Eachus addressed your question, but there's another likely misunderstanding on your part I'd like to mention. > > (generic spec file) ****************************************** > > GENERIC > > TYPE ElementType IS PRIVATE; -- any nonlimited type > TYPE IndexType IS ( <> ); -- any discrete type for > -- index value > TYPE ArrayType IS ARRAY (IndexType RANGE <>) OF ElementType; > > WITH PROCEDURE Read (Item : IN ElementType); Mode "in" seems odd for a procedure named Read. > > PROCEDURE Get_Array_Generic (List : IN OUT ArrayType); > -- Input : Array type and input file stream. > -- Action: Will read in elements and store in array. > -- Output: Array filled with elements. > > > (generic body file) ******************************************** > > PROCEDURE Get_Array_Generic (List : IN OUT ArrayType) IS > ------------------------------------------------------------------- > -- Input : Array type and input file stream. > -- Action: Will read in elements and store in array. > -- Output: Array filled with elements. > ------------------------------------------------------------------- > > Index : IndexType; > Element : ElementType; > > BEGIN -- Get_Array_Generic > > Index := List'Last; -- initialize array index to > -- first subscript This assignment is the only place this variable is mentioned in this procedure. Since you're not doing anything with it, why not eliminate it? > > FOR Index IN List'RANGE LOOP > > Read (Item => Element); -- read elements into array > > -- store data into the array > > List (Index) := Element; > > END LOOP; > > END Get_Array_Generic; Your code will look better to most of us if you use all lower case for reserved words, and use underlines instead of case to separate words in identifiers (Index_Type, not IndexType). -- Jeff Carter "It's all right, Taggart. Just a man and a horse being hung out there." Blazing Saddles