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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!feeder.news-service.com!news.netcologne.de!newsfeed-fusi2.netcologne.de!newsfeed.straub-nv.de!uucp.gnuu.de!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail Date: Fri, 03 Jul 2009 23:24:20 +0200 From: Georg Bauhaus Reply-To: rm.tsoh+bauhaus@maps.futureapps.de User-Agent: Thunderbird 2.0.0.22 (Windows/20090605) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: unsigned type References: <273dedb7-8d68-42d2-8602-aa44c79f3708@b9g2000yqm.googlegroups.com> <4b83m.98382$d36.15650@bgtnsc04-news.ops.worldnet.att.net> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Message-ID: <4a4e7705$0$31863$9b4e6d93@newsspool3.arcor-online.net> Organization: Arcor NNTP-Posting-Date: 03 Jul 2009 23:24:21 CEST NNTP-Posting-Host: 2e9fde1d.newsspool3.arcor-online.net X-Trace: DXC=N8CPUgWMCHL74okIm;?DS@McF=Q^Z^V3H4Fo<]lROoRA^YC2XCjHcbIE58@E16iK?BA:ho7QcPOVCQdQiiH;H=6Ln\\@>Md3^lJ X-Complaints-To: usenet-abuse@arcor.de Xref: g2news2.google.com comp.lang.ada:6826 Date: 2009-07-03T23:24:21+02:00 List-Id: anon wrote: > Since the RM does not directly > give one permission to use an illegal index value, then one should assume > that all index must be valid before checking for a null array. To "assume" formal properties like index validity seems inadequate: this is about index ranges, not index values, and about what the RM has to say about the formal notion of a "null range" (as has now been said many times). > Actually, > Ada RM 0 ( 29 ) states that it is illegal and the program shall create > an exception if the program "access an array component by using an > incorrect index value". There isn't any access to an array component through a null range. For indexing an array component, one must have an index value. There is no value in a null range. Therefore, there is no access to an array component. > Also, a number of ACATS test suggest this as well > and the program below will illustrate this. With that stated from the RM > the program shall > > if S'First in S'Range and then S'Last in S'Range then > if S'First <= S'Last then > -- access/create an array bound by ( S'First .. S'Last ) > else > -- return a null created array access > end if ; > else > raise Constraint_Error ; > end if ; > > You have to look at the whole RM to find out if there are other sections > that may clarify a statements or allow an exception. But there is no > RM rules that allows an out of bounds index to be used. Maybe the verse and illustrations given by J.-P. Rosen and Adam Beneschan have slipped: There are RM rules regarding null ranges. The construct "Greater .. Smaller" as used in, say, initializing a null string refers to null ranges, so not to any index value at all.