From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d85498ce48b190f0 X-Google-Attributes: gid103376,public From: Tucker Taft Subject: Re: Slicing & sliding Date: 1999/04/23 Message-ID: <3720EA2F.B359672@averstar.com>#1/1 X-Deja-AN: 470141084 Content-Transfer-Encoding: 7bit Sender: news@inmet.camb.inmet.com (USENET news) X-Nntp-Posting-Host: houdini.burl.averstar.com References: Content-Type: text/plain; charset=us-ascii Organization: AverStar (formerly Intermetrics) Burlington, MA USA Mime-Version: 1.0 Newsgroups: comp.lang.ada Date: 1999-04-23T00:00:00+00:00 List-Id: 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