From: "Jeffrey R. Carter" <spam.jrcarter.not@spam.not.acm.org>
Subject: Re: Can anyone help with GNAT.Perfect_Hash_Generators ? (Possible memory corruption)
Date: Thu, 8 Sep 2016 23:15:41 -0700
Date: 2016-09-08T23:15:41-07:00 [thread overview]
Message-ID: <nqtk2h$1o9$1@dont-email.me> (raw)
In-Reply-To: <slrnnt4k7g.1cq.lithiumcat@nat.rebma.instinctive.eu>
On 09/08/2016 11:04 PM, Natasha Kerensikova wrote:
>
> On 2016-09-08, Jeffrey R. Carter <spam.jrcarter.not@spam.not.acm.org> wrote:
>>
>> Clearly it needs to have the assumption, that all Strings have a lower bound of
>> 1, eliminated.
>>
>
> I thought it would be easier to make the assumption internally true
> instead.
>
> Since the first thing it does with the input is to copy it internally
> using the function New_Word, I would propose a fix along the line of
> replacing it from
>
> function New_Word (S : String) return Word_Type is
> begin
> return new String'(S);
> end New_Word;
>
> to
>
> function New_Word (S : String) return Word_Type is
> Result : Word_Type := new String (1 .. S'Length);
> begin
> Result.all := S;
> return Result;
> end New_Word;
Perhaps I should have said, "all Strings passed to it have a lower bound of 1".
Clearly it can ensure any characteristic it likes about Strings it creates. The
current approach assumes S has a lower bound of 1; your proposal does not. So I
consider your proposal as doing what I said.
Does
return new String (1 .. S'Length)'(S);
work?
--
Jeff Carter
"English bed-wetting types."
Monty Python & the Holy Grail
15
next prev parent reply other threads:[~2016-09-09 6:15 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-04 19:22 Can anyone help with GNAT.Perfect_Hash_Generators ? (Possible memory corruption) Natasha Kerensikova
2016-09-05 17:18 ` Stephen Leake
2016-09-06 19:24 ` Natasha Kerensikova
2016-09-06 19:52 ` Florian Weimer
2016-09-06 20:55 ` Jeffrey R. Carter
2016-09-06 21:04 ` Simon Wright
2016-09-08 16:00 ` Anh Vo
2016-09-08 17:04 ` Simon Wright
2016-09-08 18:03 ` Anh Vo
2016-09-08 18:10 ` Simon Wright
2016-09-08 19:08 ` Jeffrey R. Carter
2016-09-09 6:04 ` Natasha Kerensikova
2016-09-09 6:15 ` Jeffrey R. Carter [this message]
2016-09-09 8:25 ` J-P. Rosen
2016-09-08 19:19 ` Florian Weimer
2016-09-06 19:44 ` Florian Weimer
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox