From: Tucker Taft <stt@averstar.com>
Subject: Re: Slicing & sliding
Date: 1999/04/23
Date: 1999-04-23T00:00:00+00:00 [thread overview]
Message-ID: <3720EA2F.B359672@averstar.com> (raw)
In-Reply-To: matthewsj-ya023680002304991515390001@news.saic.com
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.
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
next prev parent reply other threads:[~1999-04-23 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 [this message]
1999-04-25 0:00 ` John B. Matthews, M.D.
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox