comp.lang.ada
 help / color / mirror / Atom feed
From: Gene Ouye <geneo@acm.org>
Subject: Re: What's wrong with this syntax?
Date: 1996/12/15
Date: 1996-12-15T00:00:00+00:00	[thread overview]
Message-ID: <32B49811.4C8@acm.org> (raw)
In-Reply-To: 587aul$hrd@zeus.orl.mmc.com


I've been away from CLA for a while, so I don't know if this
has already been answered, but John Gluth wanted to know why:

	Some_Limit : Constant := 1024;
	...
	for i in 1..(Some_Limit - 2) loop

wouldn't compile in Rational Apex.  I'm not sure which version
of Rational Apex is being used, but it compiles fine with Apex 
version 2.2.0 in an Ada 95 view.

In an Ada 83 view, the error message is:
"(Some_Limit - 2) must be a numeric literal, named number, or 
 attribute since both bounds of its enclosing range are of type
 universal integer and a conversion to INTEGER will only take 
 place in this case [RM_83 3.6.1(2)]"

This message is almost a direct quote from the 83 LRM.  The 
"(Some_Limit - 2)" is not a numeric literal, nor is it a named 
number, nor is it an attribute.  If it were, the conversion to 
Integer would take place.  This is similar to 
"for i in -5 .. 5 loop" which is illegal because -5 is not a 
numeric literal...

In other words, it's valid Ada 95 code, and it compiles fine 
as such.  It's invalid Adaa 83 code, thus it's rejected.

Gene Ouye <geneo@rational.com>




  parent reply	other threads:[~1996-12-15  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
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 [this message]
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