comp.lang.ada
 help / color / mirror / Atom feed
From: "J-P. Rosen" <rosen@adalog.fr>
Subject: Re: Can anyone help with GNAT.Perfect_Hash_Generators ? (Possible memory corruption)
Date: Fri, 9 Sep 2016 10:25:27 +0200
Date: 2016-09-09T10:25:27+02:00	[thread overview]
Message-ID: <nqtrlr$me9$1@dont-email.me> (raw)
In-Reply-To: <slrnnt4k7g.1cq.lithiumcat@nat.rebma.instinctive.eu>

Le 09/09/2016 à 08:04, Natasha Kerensikova a écrit :
> 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;
> 
Or even (avoids one copy):
   function New_Word (S : String) return Word_Type is
      subtype Slide is String (1 .. S'Length);
   begin
      return new String'(Slide(S));
   end New_Word;

-- 
J-P. Rosen
Adalog
2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX
Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00
http://www.adalog.fr


  parent reply	other threads:[~2016-09-09  8:25 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
2016-09-09  8:25                   ` J-P. Rosen [this message]
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