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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ac5c079cf53099b9,start X-Google-Attributes: gid103376,public From: bn@alsys.com (Brian Nettleton @pulsar) Subject: Question on Ada.Strings.Unbounded.Slice Date: 1996/07/15 Message-ID: #1/1 X-Deja-AN: 169037586 sender: news@thomsoft.com (USENET News Admin @flash) x-nntp-posting-host: pulsar organization: Thomson Software Products, San Diego, CA, USA keywords: Slice Strings Ada.Strings Index_Error newsgroups: comp.lang.ada summary: Should Index_Error be raised by Slice when High is > Length + 1 Date: 1996-07-15T00:00:00+00:00 List-Id: Doesn't look like my original posting went through. Here's another try (my apologies if you receive this twice). While building David Wheeler's "small" program (part of the Lovelace tutorial) I came across a problem with Ada.Strings.Unbounded.Slice. I'm getting Index_error when the High > Length(Source) + 1 (where High, Length and Source are as defined in spec of Ada.Strings.Unbounded). Here is a smaller program which displays the problem (i.e. this program raises Ada.Strings.Index_Error): with Ada.Strings.Unbounded; with Ada.Text_Io; procedure Do_Slice is package TIO renames Ada.Text_Io; begin TIO.Put_Line ( Ada.Strings.Unbounded.Slice ( Source => ASU.To_Unbounded_String( "hello" ), Low => 1, High => 7 ) ); end Do_Slice; RM A.4.4:101 states Slice "propagates Index_Error if Low > Length(Source) + 1." But the RM is silent on what happens when High > Length(Source) + 1! Is this an oversight in the RM, or by silence does the RM mean to imply that Index_Error is only raised when Low exceeds the bounds of the source? Is it implementation dependent what happens when High > Length(Source) + 1? -Brian Nettleton