From: "Yannick Duchêne (Hibou57)" <yannick_duchene@yahoo.fr>
Subject: Re: Static bounds of loop - compilation error
Date: Tue, 30 Oct 2012 18:03:38 +0100
Date: 2012-10-30T18:03:38+01:00 [thread overview]
Message-ID: <op.wmz4cc1nule2fv@cardamome> (raw)
In-Reply-To: 36d9f85f-6daa-4b0b-84b9-1a28d24da2b0@googlegroups.com
Le Tue, 30 Oct 2012 17:10:54 +0100, Adam Beneschan <adam@irvine.com> a
écrit:
> case S(I) is
>
> or
>
> case S'(I) is
>
> should make things work, because now the CASE expression has a nominal
> subtype S, which is static, rather than "S range X .. Y", which isn't.
>
> -- Adam
That indeed solve the issue.
Note that you can also declare the type at the iteration variable too, a
good practice, which is even mandatory with SPARK. Unfortunately, doing
this, ends in a GNAT bug‑box:
procedure T is
type E is (A, B, C);
subtype S is E range A .. B;
X, Y : S;
begin
X := A;
Y := B;
for I : S in X .. Y loop
case I is
when A => null;
when B => null;
end case;
end loop;
end T;
--
“Syntactic sugar causes cancer of the semi-colons.” [1]
“Structured Programming supports the law of the excluded muddle.” [1]
[1]: Epigrams on Programming — Alan J. — P. Yale University
next prev parent reply other threads:[~2012-10-30 17:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-30 13:26 Static bounds of loop - compilation error pascal.malaise
2012-10-30 14:37 ` Georg Bauhaus
2012-10-30 16:10 ` Adam Beneschan
2012-10-30 17:03 ` Yannick Duchêne (Hibou57) [this message]
2012-10-30 17:15 ` Yannick Duchêne (Hibou57)
2012-10-31 13:18 ` Marc C
2012-10-31 16:23 ` pascal.malaise
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox