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,32cfbb718858528b X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-06-08 13:06:49 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!bloom-beacon.mit.edu!nycmny1-snh1.gtei.net!news.gtei.net!news-out.visi.com!hermes.visi.com!cox.net!newsfeed1.earthlink.net!newsfeed2.earthlink.net!newsfeed.earthlink.net!wn4feed!worldnet.att.net!bgtnsc05-news.ops.worldnet.att.net.POSTED!not-for-mail Message-ID: <3D0263D2.1050604@worldnet.att.net> From: Jim Rogers User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:0.9.4) Gecko/20011128 Netscape6/6.2.1 X-Accept-Language: en-us MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Commercial C To Ada 95 compiler References: <3D002D11.CC706952@adaworks.com> <4519e058.0206071148.9b87acf@posting.google.com> <3D0116F3.7254E263@despammed.com> <3D018106.6080004@worldnet.att.net> <3D022877.B3B5CD3A@adaworks.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Date: Sat, 08 Jun 2002 20:06:49 GMT NNTP-Posting-Host: 12.86.35.247 X-Complaints-To: abuse@worldnet.att.net X-Trace: bgtnsc05-news.ops.worldnet.att.net 1023566809 12.86.35.247 (Sat, 08 Jun 2002 20:06:49 GMT) NNTP-Posting-Date: Sat, 08 Jun 2002 20:06:49 GMT Organization: AT&T Worldnet Xref: archiver1.google.com comp.lang.ada:25561 Date: 2002-06-08T20:06:49+00:00 List-Id: Richard Riehle wrote: > Jim Rogers wrote: > > >>One simple example is indexing past the end of an array. >>C compilers simply will not catch this problem. Ada compilers will. >> > > Actually, note that the following program that indexes off the end > of an array will compile in Ada. > > procedure Index_Past_The_End is > type Vector is array(Positive range <>) of Integer; > The_Vector : Vector (1..100) := (others => 0); > begin > for I in The_Vector'First .. The_Vector'Last + 1 > loop > null; > end loop; > end Index_Past_The_End; Ah, but you are not indexing the array. You are merely creating a range based upon the array index range. You can iterate through any range you want. You will get a compiler error when you attempt to access (index) an array "element" beyond either end of the array. The_Vector(The_Vector'Last + 1) := 10; Jim Rogers