comp.lang.ada
 help / color / mirror / Atom feed
From: mheaney@ni.net (Matthew Heaney)
Subject: Re: [Q] Problem with Array Concatenation?
Date: 1997/07/11
Date: 1997-07-11T00:00:00+00:00	[thread overview]
Message-ID: <mheaney-ya023680001107972012050001@news.ni.net> (raw)
In-Reply-To: ED611s.5yM.0.-s@inmet.camb.inmet.com


In article <ED611s.5yM.0.-s@inmet.camb.inmet.com>,
stt@houdini.camb.inmet.com (Tucker Taft) wrote:


>:    SA : AT;
>:    DA : AT;
>:    subtype Slided is AT (1 .. 50);
>
>Now *this* is not legal Ada (83 or 95).  You can't re-constrain
>a constrained array (sub)type.

Oops!  Tuck is, of course, correct.  I guess the compiler in my head has a
few bugs, eh?

If you're stuck with a constrained array type (perhaps it's a global type),
then you can still do the sliding solution locally by casting the array
slice into locally declared unconstrained array type:

   type AT is array (1 .. 100) of T;
...
   type Unconstrained_AT is array (Positive range <>) of T;

   SA, DA : AT;

   subtype Slid is Unconstrained_AT (1 .. 50);
begin
   ...
   DA := AT (Slid (SA (51 .. 100)) & Slid (SA (1 .. 50)));

Won't that work?

--------------------------------------------------------------------
Matthew Heaney
Software Development Consultant
<mailto:matthew_heaney@acm.org>
(818) 985-1271




  reply	other threads:[~1997-07-11  0:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-07-08  0:00 [Q] Problem with Array Concatenation? John McCabe
1997-07-08  0:00 ` Michael Quinn
1997-07-09  0:00 ` Tucker Taft
1997-07-10  0:00 ` Matthew Heaney
1997-07-11  0:00   ` Tucker Taft
1997-07-11  0:00     ` Matthew Heaney [this message]
1997-07-13  0:00     ` Robert A Duff
1997-07-13  0:00       ` John McCabe
1997-07-13  0:00     ` Keith Thompson
replies disabled

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