comp.lang.ada
 help / color / mirror / Atom feed
From: johnherro@aol.com
Subject: Re: What's wrong with this syntax?
Date: 1996/12/05
Date: 1996-12-05T00:00:00+00:00	[thread overview]
Message-ID: <19961205202700.PAA05180@ladder01.news.aol.com> (raw)
In-Reply-To: 584kr9$84s@hacgate2.hac.com


John Gluth <jpgluth@ccgate.hac.com> writes:
>Some_Limit : Constant := 1024;
> ...
>for i in 1..(Some_Limit - 2) loop
>
>It doesn't seem to want to evaluate the (Some_Limit - 2) expression.

If I'm not mistaken, your code should work with Ada 95, but not with Ada
83, which doesn't allow universal integer EXPRESSIONS in ranges when the
type isn't explicitly stated.  For the same reason, in Ada 83 you can't
write for I in -1 .. 1 loop, because -1 is an expression.

Is the compiler you mentioned Ada 83?  If so, you can fix the code either
by writing
Some_Limit : constant Integer := 1024;
or by writing
for I in Integer range 1 .. (Some_Limit - 2) loop
or by writing both.  I  hope this helps.
- John Herro
Software Innovations Technology
http://members.aol.com/AdaTutor
ftp://members.aol.com/AdaTutor




  reply	other threads:[~1996-12-05  0:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-12-04  0:00 What's wrong with this syntax? John Gluth
1996-12-05  0:00 ` johnherro [this message]
1996-12-05  0:00 ` Ken Garlington
1996-12-05  0:00   ` Bob Gilbert
1996-12-10  0:00     ` Robert Dewar
1996-12-15  0:00     ` Gene Ouye
1996-12-15  0:00       ` Matthew Heaney
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox