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: 103376,db88d0444fafe8eb X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!t-online.de!newsfeed.freenet.de!newsfeed.arcor.de!news.arcor.de!not-for-mail Date: Fri, 02 Sep 2005 12:42:06 +0200 From: Georg Bauhaus User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Surprise in array concatenation References: <1125544603.561847.32140@g47g2000cwa.googlegroups.com> <14muavojz308w.1ouv7xin79rqu$.dlg@40tude.net> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <4318486f$0$24154$9b4e6d93@newsread4.arcor-online.net> Organization: Arcor NNTP-Posting-Date: 02 Sep 2005 14:41:19 MEST NNTP-Posting-Host: a4fced9a.newsread4.arcor-online.net X-Trace: DXC=_;4N9 Dmitry A. Kazakov wrote: > On 01 Sep 2005 12:04:17 -0400, Robert A Duff wrote: >>Heh? You want this: >> >> procedure Put(S: String) is >> begin >> for I in S'First..S'Last loop -- equivalent to S'Range >> Put_Char(S(I)); >> >>to crash when S = ""? > > > Yes. What is your approach to subranges then? function h(s: String) return Unsigned_32 is prefix: String renames s(s'first .. s'first + Integer'min(3, s'length - 1)); result: Unsigned_32 := 0; begin for k in prefix'range loop result := result or Shift_Left(Character'pos(prefix(k)), (k - prefix'first) * 8); end loop; return result; end h; (If you could assume for the moment that there is no Unchecked_Conversion and not a different/better algorithm etc.) Georg