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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,8ca84a7c301c242 X-Google-Attributes: gid103376,public From: mheaney@ni.net (Matthew Heaney) Subject: Re: GNAT for loop can't count! Date: 1997/07/28 Message-ID: #1/1 X-Deja-AN: 259847594 References: <33DCBE03.27E8@reading.ac.uk> Organization: Estormza Software Newsgroups: comp.lang.ada Date: 1997-07-28T00:00:00+00:00 List-Id: In article <33DCBE03.27E8@reading.ac.uk>, William Paul Berriss wrote: >I use GNAT Ada95 compiler v3.07 on a Sun SPARC 5 runnig Solaris 2.5. This is a very old version of GNAT; the current public release is 3.09. Have you considered upgrading? Also, there is a discussion list for GNAT specificially, called . Go to the ACT website at to get info about signing up, and consider posting GNAT-specific queries there. >I have very simple for loop that should count upwards from 118 to 129 >but it counts 118, ..., 126, 127, -128, -127 (i.e. changes to >Negative after 127) > >Here is the loop: > > for P in Pixel(Firstp)..Pixel(Lastp) loop > > Ada.Integer_Text_IO.Put(Integer(P)); > Ada.Text_IO.New_line; > > end loop; > >Where Pixel is Integer range 0..255 >and >Firstp and Lastp at this point are 118 and 129 respectively. >Both of type Pixel. What is type Pixal? Is it subtype Pixal is Integer range 0 .. 255; If so, then why did you declare your loop as you did? Why the cast to Pixal type, if Firstp and Lastp are already type Pixal? Why not for P in Pixal range Firstp .. Lastp loop Also, why did you cast the loop index to type integer, if Pixal is already a subtype of Integer? Why not Ada.Integer_Text_IO.Put (P); It would help if you showed the _exact_ declaration of type Pixal. -------------------------------------------------------------------- Matthew Heaney Software Development Consultant (818) 985-1271