From: "Jeffrey R. Carter" <spam.jrcarter.not@spam.not.acm.org>
Subject: Re: Ada.Strings.Fixed.Count raises Storage_Error
Date: Sun, 26 Jun 2016 17:21:25 -0700
Date: 2016-06-26T17:21:25-07:00 [thread overview]
Message-ID: <nkpri6$odg$1@dont-email.me> (raw)
In-Reply-To: <bd07cd4b-6bfc-4cd0-83b9-a53bb3e7ecea@googlegroups.com>
On 06/26/2016 04:23 PM, rieachus@comcast.net wrote:
>
> How about no one reports this non-existent error? This is a category of
> problem that the ARG decided long ago should be considered pathologies. The
> original case was a program that checked whether a task returned by a
> function was Terminated. (The "correct" answer was True, but the program was
> totally useless for anything other than making compiler developers lives
> miserable.)
>
> A string which ends at Integer'Last is either huge enough to raise
> Storage_Error anyway, or a clever compiler test that exists only to make
> compiler developers lives miserable. I'm retired now, so I can say that
> without insulting customers. And as Randy pointed out anything is allowed to
> raise Storage_Error. That might not be user friendly, but in this case
> (Strings ending at Integer'Last) no sensible user is going to run into the
> problem.
While I mostly agree, this one, given the code presented earlier, is a 1-line
change to correct, which hardly seems like it would make developers' lives
miserable:
while Ind <= Source'Last loop
if Pattern = Source (Ind .. Ind) then
...
else
Ind := Ind + 1;
end if;
end loop;
Add
exit when Ind = Integer'Last;
after "else". I see no reason this code shouldn't correctly handle this corner case.
--
Jeff Carter
"[T]he Musgroves had had the ill fortune
of a very troublesome, hopeless son, and
the good fortune to lose him before he
reached his twentieth year ..."
Persuasion
154
next prev parent reply other threads:[~2016-06-27 0:21 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-12 11:36 Ada.Strings.Fixed.Count raises Storage_Error Xavier Petit
2016-05-12 15:22 ` Tero Koskinen
2016-05-12 22:05 ` Georg Bauhaus
2016-06-26 21:18 ` Victor Porton
2016-06-26 23:23 ` rieachus
2016-06-27 0:21 ` Jeffrey R. Carter [this message]
2016-06-27 4:00 ` rieachus
2016-06-27 0:51 ` Xavier Petit
2016-06-27 4:48 ` rieachus
2016-06-28 18:25 ` Xavier Petit
2016-06-29 18:49 ` Niklas Holsti
2016-06-29 19:40 ` Jeffrey R. Carter
2016-06-29 19:57 ` Dmitry A. Kazakov
2016-07-01 11:48 ` rieachus
2016-07-01 13:08 ` Dmitry A. Kazakov
2016-06-27 8:29 ` Simon Wright
2016-06-27 8:41 ` Georg Bauhaus
2016-06-29 8:15 ` Niklas Holsti
2016-06-29 9:13 ` J-P. Rosen
2016-06-29 17:43 ` Niklas Holsti
2016-06-29 18:19 ` J-P. Rosen
2016-06-29 20:30 ` Robert A Duff
2016-06-30 5:38 ` Niklas Holsti
2016-07-01 10:40 ` rieachus
2016-07-01 10:55 ` J-P. Rosen
2016-07-01 12:17 ` rieachus
2016-07-01 12:55 ` G.B.
2016-06-27 12:52 ` Victor Porton
2016-05-12 22:56 ` Randy Brukardt
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox