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.5 required=5.0 tests=BAYES_00, PP_MIME_FAKE_ASCII_TEXT,REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,caabf5265fad78e5 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!news1.google.com!npeer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!cyclone1.gnilink.net!gnilink.net!wn11feed!worldnet.att.net!bgtnsc05-news.ops.worldnet.att.net.POSTED!53ab2750!not-for-mail Newsgroups: comp.lang.ada From: anon@anon.org (anon) Subject: Re: unsigned type Reply-To: anon@anon.org (anon) References: X-Newsreader: IBM NewsReader/2 2.0 Message-ID: Date: Mon, 29 Jun 2009 20:19:39 GMT NNTP-Posting-Host: 12.65.6.97 X-Complaints-To: abuse@worldnet.att.net X-Trace: bgtnsc05-news.ops.worldnet.att.net 1246306779 12.65.6.97 (Mon, 29 Jun 2009 20:19:39 GMT) NNTP-Posting-Date: Mon, 29 Jun 2009 20:19:39 GMT Organization: AT&T Worldnet Xref: g2news2.google.com comp.lang.ada:6731 Date: 2009-06-29T20:19:39+00:00 List-Id: Wrong re-read RM 3.5 (8) An Empty string may be a "Null range" string but zero ( 0 ) is not within the subtype of the Positive type. The second sentence of RM 3.5 ( 8 ) forces the index to be valid for all references including a null range statement. Also, as I pointed out to Adam, about "Ada.Command_line" there may be other sections that may strengthen or may redefine RM 3.5 ( 8 ). A : String ; ... A ( 1..1 ) -- is a valid string with a null range also equal -- to character reference of A ( 1 ) A ( 0..0 ) -- is not valid because the index range is not within -- the valid range of the subtype Postive. -- And at least the compiler should of trap the error. -- Or is this a Compiler Bug! RM 3.5 8 A range is compatible with a scalar subtype if and only if it is either a null range or each bound of the range belongs to the range of the subtype. A range_constraint is compatible with a scalar subtype if and only if its range is compatible with the subtype. And name calling show just how childless you are. In , Jean-Pierre Rosen writes: >anon a �crit : >> For Strings: >> -- 'A' is a zero length string, A'Last = 0, and >> -- put_line ( A ( A'First .. A'Last ) ) ; >> -- does not raise an Constraint_Error even though in >> -- this case it translate to: >> -- put_line ( A ( 0 .. 0 ) ) ; >> A : String := "" ; >> >> Since you can have zero length string , the index is Natual instead of Positive, >> because zero is in Natural but is not define in Positive. Even though the >> Standard package define String index as a Positive type. (GNAT) >> >I usually refrain from responding to "anon", but this is so wrong that I >have to... (Note: in French, "anon" is a young donkey; maybe that's >where he got his name from...) > >The index of String is Positive, full stop. A'Last is 0 because null >ranges are treated specially to avoid spurious Constraint_Error. See 3.5(8) >-- >--------------------------------------------------------- > J-P. Rosen (rosen@adalog.fr) >Visit Adalog's web site at http://www.adalog.fr