From: Adam Beneschan <adam@irvine.com>
Subject: Re: index check failure - constraint error
Date: Fri, 1 Apr 2011 16:00:48 -0700 (PDT)
Date: 2011-04-01T16:00:48-07:00 [thread overview]
Message-ID: <716e8fba-c396-4d47-81ef-c7b275f919a8@f15g2000pro.googlegroups.com> (raw)
In-Reply-To: wccpqp5io4e.fsf@shell01.TheWorld.com
On Apr 1, 3:49 pm, Robert A Duff <bobd...@shell01.TheWorld.com> wrote:
> Jeffrey Carter <spam.jrcarter....@spam.not.acm.org> writes:
> > The idea that Strings always have a lower bound of 1 is quite common
> > among beginners.
>
> Whereas experts understand that it OUGHT to be true that
> "Strings always have a lower bound of 1", but it isn't true.
> It's a design flaw in the Ada language.
>
> > In SPARK all Strings do have a lower bound of 1.
>
> As they should. It really makes things simpler.
> And (could be) more efficient.
I dunno. I kind of like it that if I'm parsing a string, and I call
Next_Item := Ada.Strings.Fixed.Index_Non_Blank (S
(Current_Index .. S'Last));
then Next_Item is the index of the actual character in S that I need,
and I don't need to add Current_Index to it and then think about
whether I need to add 1 or subtract 1 from the sum, as I'd have to do
something like that if Index_Non_Blank saw its Source parameter as a
string with a lower bound of 1.
-- Adam
next prev parent reply other threads:[~2011-04-01 23:00 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-01 10:53 index check failure - constraint error tonyg
2011-04-01 11:07 ` tonyg
2011-04-01 11:27 ` Alex Mentis
2011-04-01 11:33 ` Alex Mentis
2011-04-01 11:36 ` Alex Mentis
2011-04-01 12:18 ` Georg Bauhaus
2011-04-01 22:20 ` tonyg
2011-04-01 23:37 ` Ludovic Brenta
2011-04-01 11:12 ` Egil Høvik
2011-04-01 11:17 ` tonyg
2011-04-01 12:13 ` Ludovic Brenta
2011-04-01 15:02 ` Adam Beneschan
2011-04-01 17:39 ` Jeffrey Carter
2011-04-01 22:16 ` tonyg
2011-04-01 22:31 ` Jeffrey Carter
2011-04-01 22:49 ` Robert A Duff
2011-04-01 23:00 ` Adam Beneschan [this message]
2011-04-01 23:29 ` Robert A Duff
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox