comp.lang.ada
 help / color / mirror / Atom feed
From: dewar@merv.cs.nyu.edu (Robert Dewar)
Subject: Re: Slice and Unbounded String
Date: 1996/11/27
Date: 1996-11-27T00:00:00+00:00	[thread overview]
Message-ID: <dewar.849154959@merv> (raw)
In-Reply-To: 01bbdc70$2e557160$262a6282@cln49ae


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.






      parent reply	other threads:[~1996-11-27  0:00 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <01bbdc70$2e557160$262a6282@cln49ae>
1996-11-27  0:00 ` Slice and Unbounded String Robert A Duff
1996-11-30  0:00   ` Robert Dewar
1996-12-01  0:00     ` Robert A Duff
1996-12-01  0:00       ` Robert Dewar
1996-12-01  0:00         ` Ben Brosgol
1996-12-09  0:00     ` Gnat v3.05 bug or compilation problem MAKOUDI Jaouad (Stag. Kermarrec)
1996-12-09  0:00       ` Root of a GNAT problem (was: " Peter Hermann
1996-12-09  0:00         ` Norman H. Cohen
1996-12-09  0:00         ` Robert Dewar
1996-12-10  0:00           ` Ken Garlington
1996-12-10  0:00             ` Tom Moran
1996-12-11  0:00               ` Robert Dewar
1996-12-11  0:00               ` Larry Kilgallen
1996-12-11  0:00                 ` Robert Dewar
1996-12-11  0:00                 ` Norman H. Cohen
1996-12-11  0:00                   ` Tom Moran
1996-12-12  0:00                     ` Larry Kilgallen
1996-12-11  0:00               ` Peter Hermann
1996-12-11  0:00                 ` Robert Dewar
1996-12-12  0:00               ` John Cosby
1996-12-13  0:00                 ` Robert Dewar
1996-12-10  0:00             ` Robert Dewar
1996-12-09  0:00         ` Larry Kilgallen
1996-12-09  0:00           ` Robert Dewar
1996-12-10  0:00             ` Larry Kilgallen
1996-12-10  0:00               ` Robert Dewar
1996-12-10  0:00             ` Peter Hermann
1996-12-10  0:00               ` Robert Dewar
1996-12-10  0:00             ` Tom Moran
1996-12-11  0:00               ` Robert Dewar
1996-12-18  0:00               ` Ted Dennison
1996-12-18  0:00                 ` Tom Moran
1996-12-23  0:00                   ` Robert Dewar
1996-12-09  0:00       ` Larry Kilgallen
1996-11-27  0:00 ` Robert Dewar [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox