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=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=unavailable autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,f0b19a44b99ada68 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-06-25 23:56:51 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!skynet.be!skynet.be!freenix!enst.fr!not-for-mail From: christoph.grein@eurocopter.com Newsgroups: comp.lang.ada Subject: Re: Type inference in loops with immediate constants Date: Thu, 26 Jun 2003 08:18:49 +0200 (MET DST) Organization: ENST, France Message-ID: Reply-To: grein@egypt.otn.eurocopter.de NNTP-Posting-Host: marvin.enst.fr Mime-Version: 1.0 Content-Type: TEXT/plain; charset=us-ascii X-Trace: avanie.enst.fr 1056610610 17064 137.194.161.2 (26 Jun 2003 06:56:50 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Thu, 26 Jun 2003 06:56:50 +0000 (UTC) To: comp.lang.ada@ada.eu.org Return-Path: X-Authentication-Warning: mail.eurocopter.com: uucp set sender to using -f Content-MD5: g+4CEBt2pERRLLFVxHOOUg== X-Mailer: dtmail 1.2.1 CDE Version 1.2.1 SunOS 5.6 sun4u sparc X-BeenThere: comp.lang.ada@ada.eu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: comp.lang.ada mail to news gateway List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Xref: archiver1.google.com comp.lang.ada:39763 Date: 2003-06-26T08:18:49+02:00 > Length : Positive; -- reminder : subtype Integer range 1 .. Integer'Last > > for Index in 0 .. Length - 1 loop > > --- > > Then what type Index should be ? > > Positive ? > > Obviously not, because of the 0, which is not a Positive, as a starting > value. > > Integer ? > > Is the compiler using the fact that a positive is derived from an universal > integer and thus decides to give the base type to the loop variable ? Note that Positive is not a type, but a subtype of Integer. So Index is of type Integer with a constraint of 0 .. Length -1.