From: stt@houdini.camb.inmet.com (Tucker Taft)
Subject: Re: unconstrainded array question
Date: 1998/09/19
Date: 1998-09-19T00:00:00+00:00 [thread overview]
Message-ID: <EzJ58u.JD9.0.-s@inmet.camb.inmet.com> (raw)
In-Reply-To: therionics-1809981854540001@a1.phoenix-21.goodnet.com
Technobabble (therionics@computer.org) wrote:
: Greetings,
: anyone know if it is legal or not in Ada95 to use a RANGE attribute on
: an unconstrained array, as in the example:
There is no such thing as an "unconstrained" array object. There are
unconstrained array *subtypes*." In the example below, the
"first subtype" UC_Array of the array type is unconstrained, but
the subtype of the object xyz is constrained to 1..100.
Extra care here in using terminology is important.
: package My_Package is
: procedure XYZ (This : in Object);
: type UC_Array is array (integer <>) of integer;
: xyz : AC_Array (1..100);
^^^
This is illegal overloading by the way, since you can't have both
an overloadable declaration like the procedure XYZ and a non-overloadable
declaration like the array xyz in the same declarative region
(remember upper/lower case is irrelevant in Ada identifiers).
: end My_Package;
: then in the body ....
: procedure XYZ (This : Object) is
: begin
: for I in This.xyz'RANGE
The 'Range attribute is allowed on *all* array objects, and on
all *constrained* array subtypes. So UC_Array'Range would be
illegal, but <any_array_obj>'Range is allowed.
: loop
: ......
: end XYZ;
: Thanks,
: Richmond
--
-Tucker Taft stt@inmet.com http://www.inmet.com/~stt/
Intermetrics, Inc. Burlington, MA USA
An AverStar Company
next prev parent reply other threads:[~1998-09-19 0:00 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-09-19 0:00 unconstrainded array question Technobabble
1998-09-19 0:00 ` Tucker Taft [this message]
1998-09-19 0:00 ` Tom Moran
1998-09-19 0:00 ` dewarr
1998-09-19 0:00 ` Technobabble
1998-09-19 0:00 ` dewarr
1998-09-19 0:00 ` dewarr
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox