comp.lang.ada
 help / color / mirror / Atom feed
From: matthewsj@deleteme.saic.com (John B. Matthews, M.D.)
Subject: Re: Slicing & sliding
Date: 1999/04/25
Date: 1999-04-25T00:00:00+00:00	[thread overview]
Message-ID: <matthewsj-ya023680002504992205530001@news.saic.com> (raw)
In-Reply-To: 3720EA2F.B359672@averstar.com

In article <3720EA2F.B359672@averstar.com>, Tucker Taft <stt@averstar.com>
wrote:

> John B. Mattehws, M.D. wrote:
> > 
> > Given the following program
> > 
> > with Text_IO;
> > 
> > procedure Slice is
> > 
> > S : String (1 .. 64) := (others => '.');
> > 
> >     function F return String is
> >     begin
> >         return "result";
> >     end F;
> > 
> > begin
> > 
> >     Text_IO.Put_Line(S);
> >     S(S'Range) := F(S'Range);
> >     Text_IO.Put_Line(S);
> > 
> > end Slice;
> > 
> > The output is
> > ................................................................
> > result
> > 
> > I was suprised to see that the indicated slice of F (F(S'Range)) is allowed
> > to be larger than the result returned by F, despite RM 4.1.2(7). For
> > smaller slices, the remainder of S seems to slide down, and the rest is
> > padded with nulls. Can someone help me understand this? Is this conformant
> > with the RM?
> 
> Sure looks like a compiler bug to me.  Alternatively, you
> are suppressing constraint checks without knowing it.

The latter, of course. Now clear in restrospect:-)

Thanks,

John

> On my favorite compiler, your program prints the line of dots, and
> then dies with an unhandled Constraint_Error on the slice
> assignment.
> 
> > Thanks,
> > 
> > John
> > ----
> > John B. Matthews, M.D.
> > matthewsj@saic.com; jmattthews@nova.wright.edu
> 
> -- 
> -Tucker Taft   stt@averstar.com   http://www.averstar.com/~stt/
> Technical Director, Distributed IT Solutions  (www.averstar.com/tools)
> AverStar (formerly Intermetrics, Inc.)   Burlington, MA  USA




      reply	other threads:[~1999-04-25  0:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-04-23  0:00 Slicing & sliding John B. Mattehws, M.D.
1999-04-23  0:00 ` Tucker Taft
1999-04-25  0:00   ` John B. Matthews, M.D. [this message]
replies disabled

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