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!news3.google.com!newsfeed2.dallas1.level3.net!news.level3.com!newsfeed-00.mathworks.com!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Surprise in array concatenation Date: 01 Sep 2005 12:04:17 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <1125544603.561847.32140@g47g2000cwa.googlegroups.com> <14muavojz308w.1ouv7xin79rqu$.dlg@40tude.net> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls4.std.com 1125590657 28277 192.74.137.71 (1 Sep 2005 16:04:17 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Thu, 1 Sep 2005 16:04:17 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Xref: g2news1.google.com comp.lang.ada:4376 Date: 2005-09-01T12:04:17-04:00 List-Id: "Dmitry A. Kazakov" writes: > On 31 Aug 2005 20:16:43 -0700, Gene wrote: > > > Nonetheless the rule seems silly: When a leading zero-length array is > > catenated to another array the result takes on the starting index of > > the _second_ operand. This doesn't make sense to me. Why not use the > > starting index of the zero-length array? > > Because that might be ill-defined, I guess. > > A more interesting question is why Empty'First does not raise any > exception. 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 = ""? >... After all, there is no any lower bound of an empty index range. In Ada, every range, and every array, has both a lower and an upper bound. > Provided, that empty arrays are all same, of course. Depends on what you mean by "same". ;-) Different empty arrays can have different bounds -- but "=" returns True! >... If not, then another > interesting question would appear: how to make an empty array with the > lower bound Integer'First? You can't. You should always make sure Index'First > Index'Base'First when using the "Index range <>" syntax. (But you don't need to do that when you have a constrained array -- "...array(Index) of ...".) - Bob