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: matthewsj@deleteme.saic.com (John B. Matthews, M.D.) Subject: Re: Slicing & sliding Date: 1999/04/25 Message-ID: #1/1 X-Deja-AN: 470876285 Content-transfer-encoding: 8bit References: <3720EA2F.B359672@averstar.com> Content-Type: text/plain; charset=ISO-8859-1 Organization: SAIC Mime-Version: 1.0 Newsgroups: comp.lang.ada Date: 1999-04-25T00:00:00+00:00 List-Id: In article <3720EA2F.B359672@averstar.com>, Tucker Taft 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