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,70463e369385ff2a X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-07-05 15:52:38 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news.tele.dk!212.74.64.35!colt.net!newspeer.clara.net!news.clara.net!news5-gui.server.ntli.net!ntli.net!news6-win.server.ntlworld.com.POSTED!not-for-mail From: "chris.danx" Newsgroups: comp.lang.ada References: Subject: Re: explain error to me MIME-Version: 1.0 Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Message-ID: <08617.5643$Tv5.787326@news6-win.server.ntlworld.com> Date: Thu, 5 Jul 2001 23:48:41 +0100 NNTP-Posting-Host: 62.253.12.229 X-Complaints-To: abuse@ntlworld.com X-Trace: news6-win.server.ntlworld.com 994373244 62.253.12.229 (Thu, 05 Jul 2001 23:47:24 BST) NNTP-Posting-Date: Thu, 05 Jul 2001 23:47:24 BST Organization: ntlworld News Service Xref: archiver1.google.com comp.lang.ada:9508 Date: 2001-07-05T23:48:41+01:00 List-Id: "Beau" wrote in message news:tk9pumjsd3j8b3@corp.supernews.com... > I am getting an error can someone help: > the spec file as follows: Beau, I'm not bashing you, but could you please provide the error next time. Like I say it's not that i'm bashing you, it helps ppl help you, sometimes without the need to compile your source. I got this error "print_table.ads:23:28: invalid subtype mark in discrete range" which refered to this line TYPE HouseArrays IS ARRAY (ArraySize) OF HouseHolds; Arraysize is defined like this ArraySize : CONSTANT Positive := 25; The error is due to the fact that ArraySize is not a range, but a constant. 25 is not the same as 1..25, so Ada rejects this. You could do one of the following 1) declare HouseArrays like this TYPE HouseArrays IS ARRAY (1..ArraySize) OF HouseHolds; 2) declare a type like this -- a type representing the range of the number -- of houses SUBTYPE NumHouses is Natural range 1..25; then declare houseArrays like this TYPE HouseArrays IS ARRAY (NumHouses'first..NumHouses'last) OF HouseHolds; 3) Reuse ArrayCounter type as in 2. TYPE HouseArrays IS ARRAY (ArrayCounter'first..ArrayCounter'last) OF HouseHolds; I'm assuming that you've learned about attributes for 2 and 3. In the computing science course at glasgow uni, they taught this near the beginning when they taught strings and string declarations. This is why i'm assuming attributes, if you don't know what they are stick with solution 1 and/or just ask and some one here. ( I know you like extra cred :-) ) Hope this helps, Chris Campbell