From: christoph.grein@eurocopter.com
To: comp.lang.ada@ada.eu.org
Subject: Re: Type inference in loops with immediate constants
Date: Thu, 26 Jun 2003 08:18:49 +0200 (MET DST)
Date: 2003-06-26T08:18:49+02:00 [thread overview]
Message-ID: <mailman.15.1056610609.8204.comp.lang.ada@ada.eu.org> (raw)
> 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.
next reply other threads:[~2003-06-26 6:18 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-06-26 6:18 christoph.grein [this message]
-- strict thread matches above, loose matches on Subject: below --
2003-06-25 20:54 Type inference in loops with immediate constants Guillaume Foliard
2003-06-26 1:40 ` Jeffrey Carter
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox