comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R. Carter" <spam.jrcarter.not@spam.not.acm.org>
Subject: Re: strange length check error
Date: Wed, 17 Jan 2018 22:37:50 +0100
Date: 2018-01-17T22:37:50+01:00	[thread overview]
Message-ID: <p3ofne$gbu$1@dont-email.me> (raw)
In-Reply-To: <lyy3kw8uvt.fsf@pushface.org>

On 01/17/2018 02:41 PM, Simon Wright wrote:
> 
>     return
>       (LENGTH(LEFT) + 1,
>        LEFT.DATA(1..LENGTH(LEFT))
>          & RIGHT
>          & LEFT.DATA((LENGTH(LEFT) + 1)..MAX_LENGTH));

I think the last part should be Left.Data (Left.Length + 1 .. Max_Length - 1) or 
(Left.Length + 2 .. Max_Length). I guess it doesn't matter what you put in those 
unused positions; you could also have (Left.Length + 2 .. Max_Length => <>).

I'd probably have written

    Result : Bounded_String;
begin -- "&"
    Result.Length := Left.Length + 1;
    Result.Data (1 .. Result.Length) := Left (1 .. Left.Length) & Right;

    return Result;

-- 
Jeff Carter
"We'll make Rock Ridge think it's a chicken
that got caught in a tractor's nuts!"
Blazing Saddles
87

  reply	other threads:[~2018-01-17 21:37 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-16 20:48 strange length check error Mehdi Saada
2018-01-17  1:42 ` Anh Vo
2018-01-17  9:23   ` Simon Wright
2018-01-17 12:13     ` Mehdi Saada
2018-01-17 13:19       ` AdaMagica
2018-01-17 13:41         ` Simon Wright
2018-01-17 21:37           ` Jeffrey R. Carter [this message]
2018-01-18 11:12             ` Simon Wright
2018-01-17 13:43         ` Mehdi Saada
2018-01-17 14:03           ` Mehdi Saada
2018-01-17 16:15             ` Mehdi Saada
2018-01-17 19:43               ` Simon Wright
2018-01-17 21:37                 ` Mehdi Saada
2018-01-17 23:00                   ` Niklas Holsti
2018-01-18 11:07                     ` Simon Wright
2018-01-17 13:15     ` Simon Clubley
2018-01-17  8:49 ` Dmitry A. Kazakov
2018-01-23 16:18 ` Robert Eachus
2018-01-23 16:41   ` Mehdi Saada
2018-01-24 16:22     ` Robert Eachus
replies disabled

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