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-23 12:25:34 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!wn11feed!worldnet.att.net!207.217.77.102!newsfeed2.earthlink.net!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!newsread1.prod.itd.earthlink.net.POSTED!not-for-mail Message-ID: <3DB6F7A3.5060302@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> <3DB59D75.20609 <3DB60342.3020104@acm.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 23 Oct 2002 19:24:43 GMT NNTP-Posting-Host: 63.184.0.14 X-Complaints-To: abuse@earthlink.net X-Trace: newsread1.prod.itd.earthlink.net 1035401083 63.184.0.14 (Wed, 23 Oct 2002 12:24:43 PDT) NNTP-Posting-Date: Wed, 23 Oct 2002 12:24:43 PDT Organization: EarthLink Inc. -- http://www.EarthLink.net Xref: archiver1.google.com comp.lang.ada:30082 Date: 2002-10-23T19:24:43+00:00 List-Id: Robert A Duff wrote: > Not true. I wasn't thinking clearly. For the example given, you are > correct that a bounds check is needed, at least on the upper bound. I > suppose the compiler could optimize away the check on the lower bound. I would think even on the lower bound. The compiler knows nothing about the bounds. The lower bound could be any value in Positive, so a variable in Positive could easily be less than the lower bound just as it could be greater than the upper bound. > > In any case, although I put my foot in my mount about *that* example, I > think my more general point is correct: there are cases where an Ada 83 > compiler could optimize away checks (based on the erroneousness of > uninit vars), where an Ada 95 compiler cannot (or at least has to prove > more). If the variable has the same subtype as the index of the array object, I can see this: procedure Op (S : in out String) is I : Positive range S'range; begin -- Op S (I) := 'x'; end Op; I is either in range or execution is erroneous. As I said in another post, a source of unexpected Constraint_Errors I encountered in Ada 83 was from beginners assuming the lower bound of a String parameter was one. A bounds check is required unless the index is known to the compiler to be in the index range of the array object. I guess String was not a good type to use for an example. If it had been type Index is range 1 .. 100; type Arr is array (Index) of Integer; I : Index; A : Arr ... A (I) := 1; it would have been more obvious what we're talking about (I think). -- Jeff Carter "English bed-wetting types." Monty Python & the Holy Grail