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,FREEMAIL_FROM, WEIRD_QUOTING autolearn=ham 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!postnews.google.com!q11g2000yqi.googlegroups.com!not-for-mail From: sjw Newsgroups: comp.lang.ada Subject: Re: unsigned type Date: Sat, 11 Jul 2009 10:18:34 -0700 (PDT) Organization: http://groups.google.com Message-ID: <0901710a-dc70-4c8d-a5db-9d1e3773134f@q11g2000yqi.googlegroups.com> References: NNTP-Posting-Host: 82.20.239.89 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1247332714 22659 127.0.0.1 (11 Jul 2009 17:18:34 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sat, 11 Jul 2009 17:18:34 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: q11g2000yqi.googlegroups.com; posting-host=82.20.239.89; posting-account=_RXWmAoAAADQS3ojtLFDmTNJCT0N2R4U User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_7; en-us) AppleWebKit/530.19.2 (KHTML, like Gecko) Version/4.0.2 Safari/530.19,gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:6991 Date: 2009-07-11T10:18:34-07:00 List-Id: On Jul 11, 3:40=A0pm, Hibou57 (Yannick Duch=EAne) wrote: > The length of a string is Natural, the index type Positive, as long as > lowest bound is 1. The index type of String is always positive! > Printing a zero length string does not imply attempting to print > chracters in index range 1 .. 0, but may be instead properly handled > by simple not accessing the string and simply not printing anything, > providing the length has been previously known to be zero. I think this is too restrictive! This: with Ada.Text_IO; use Ada.Text_IO; procedure Zero_Length_String is S : String (-5 .. -7) :=3D ""; begin Put_Line ("S is """ & S & """, 'First is " & Integer'Image (S'First) & ", 'Last is " & Integer'Image (S'Last)); Put_Line ("S is """ & S (S'First .. S'Last) & """"); end Zero_Length_String; results (GNAT GPL 2009) in $ ./zero_length_string S is "", 'First is -5, 'Last is -7 S is ""