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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ae9506fd4dcf7090 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-10-22 11:48:38 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!paloalto-snf1.gtei.net!news.gtei.net!enews.sgi.com!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!newsfeed.news2me.com!newsfeed2.earthlink.net!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!newsread1.prod.itd.earthlink.net.POSTED!not-for-mail Message-ID: <3DB59D75.2060906@acm.org> From: Jeffrey Carter User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.0.0) Gecko/20020530 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Concatenation and Characters References: <44hp9.807$_u6.205@nwrddc01.gnilink.net> <3DA5AE5F.3030902@attbi.com> <3DB03EF1.EE771923@mmm.com> <3DB43EB0.AAF4B38C@mmm.com> <3DB44B9C.80007@worldnet.att.net> <3DB466CB.7CE0BC59@mmm.com> <3DB4AD20.4070109@acm.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Date: Tue, 22 Oct 2002 18:47:49 GMT NNTP-Posting-Host: 63.184.8.189 X-Complaints-To: abuse@earthlink.net X-Trace: newsread1.prod.itd.earthlink.net 1035312469 63.184.8.189 (Tue, 22 Oct 2002 11:47:49 PDT) NNTP-Posting-Date: Tue, 22 Oct 2002 11:47:49 PDT Organization: EarthLink Inc. -- http://www.EarthLink.net Xref: archiver1.google.com comp.lang.ada:30041 Date: 2002-10-22T18:47:49+00:00 List-Id: Matthew Heaney wrote: > This isn't quite right. If an object of a discrete type is used to index an > array, the compiler is required to ensure that the object --even if > uninitialized-- is only used to index an actual component of the array > object. > > For example: > > procedure Op (S : String) is > I : Positive; > begin > S (I) := 'x'; > end; I presume you mean "S : in out String"? > > The Ada95 language guarantees that index I will only touch the memory owned > by array object S. > > This is one area where Ada95 differs from Ada83, which made no such > guarantee. This has nothing to do with detecting a reference to an uninitialized variable. It is about bound checking of array indexing, which did exist in Ada 83. Unless run-time checks are suppressed, this behaves as if it were written procedure Op (S : in out String) is I : Positive; begin if I not in S'range then raise Constraint_Error; end if; S (I) := 'x'; end Op; This was true in Ada 83. This is true even if I is initialized: -- In Op: I : Positive := 7; -- Elsewhere: X : String := "abcdefg"; ... Op (S => X (3 .. 5) ); -- Raises Constraint_Error With run-time checks suppressed, what happens is anyone's guess, in Ada 83 and Ada. -- Jeff Carter "This school was here before you came, and it'll be here before you go." Horse Feathers