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-Thread: a07f3367d7,56525db28240414a X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.216.237.155 with SMTP id y27mr568669weq.11.1344263365630; Mon, 06 Aug 2012 07:29:25 -0700 (PDT) MIME-Version: 1.0 Path: q11ni72442439wiw.1!nntp.google.com!feed-C.news.volia.net!volia.net!news2.volia.net!feed-A.news.volia.net!border1.nntp.ams2.giganews.com!border2.nntp.ams2.giganews.com!border4.nntp.ams.giganews.com!border2.nntp.ams.giganews.com!nntp.giganews.com!news.panservice.it!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!weretis.net!feeder4.news.weretis.net!nuzba.szn.dk!news.jacob-sparre.dk!munin.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Efficient Sequential Access to Arrays Date: Mon, 30 Jul 2012 22:12:27 -0500 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: <01983f1c-f842-4b1f-a180-bcef531dad4c@googlegroups.com> <87ipdf4vh6.fsf@mid.deneb.enyo.de> <4ce44d2d-d789-42a0-a6ed-035f7f8d58be@googlegroups.com> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1343704350 27626 69.95.181.76 (31 Jul 2012 03:12:30 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Tue, 31 Jul 2012 03:12:30 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Date: 2012-07-30T22:12:27-05:00 List-Id: "Keean Schupke" wrote in message news:b18e5dd8-cd07-49df-8011-22e911dc1da0@googlegroups.com... On Thursday, 26 July 2012 01:15:25 UTC+1, Randy Brukardt wrote: ... >> Ada scalar objects can be in a state known as "invalid" (see >> 13.9.1 in your >> Ada Reference Manual). For integer types, this corresponds to a value out >> of >> range. Ada compilers are always allowed to return invalid results from >> scalar operations, with a few exceptions. So in general, an Ada compiler >> does not actually need to make range checks on scalar objects. The only >> time >> that a check on a scalar object *has* to be performed is when using the >> value could lead to erroneous execution (such as in indexing out of >> range). > >This is an equivalent concept to nullable, so two questions: > >What is the literal for 'invalid', IE: > >X : Index := #INVALID -- we should be able to initialise to invalid. A subtype doesn't necessarily have any invalid values, so this is impossible in general. For instance, you can't write this for type Integer. Pragma Normalize_Scalars does what you want if that's possible, but it applies to all objects in a program. (There's no way to do use it on a case-by-case basis.) >if X = #INVALID -- I want to be able to test for invalid. if not X'Valid then will do the trick. Randy.