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,978f50245fc02645 X-Google-Attributes: gid103376,public From: dewar@merv.cs.nyu.edu (Robert Dewar) Subject: Re: Slice and Unbounded String Date: 1996/11/27 Message-ID: #1/1 X-Deja-AN: 201235835 references: <01bbdc70$2e557160$262a6282@cln49ae> organization: New York University newsgroups: comp.lang.ada Date: 1996-11-27T00:00:00+00:00 List-Id: Pascal asks: "With the following command : S := Ada.Strings.Unbounded.Slice (U, 6, 8); Should S have a range 6 .. 8 or a range 1 .. 3. For me (after reading the RM) the first solution is the good one. The answer will told me if GNAT or ObjectAda has a bug :-)" The range should be 1 .. 3. This is unambiguously clear from the RM. !.45(1) says 1 The language-defined package Strings.Unbounded provides a private type Unbounded_String and a set of operations. An object of type Unbounded_String represents a String whose low bound is 1 and whose length can vary conceptually between 0 and Natural'Last. The subprograms for fixed-length string handling are either overloaded directly for Unbounded_String, or are modified as needed to reflect the flexibility in length. Since the Unbounded_String type is private, relevant constructor and selector operations are provided. Note the important statement here about the low bound being 1. So all unbounded strings always have a lower bound of 1. GNAT certainly returns a lower bound of 1 in accordance with the RM requirement.