From: Pascal Obry <pascal@obry.net>
Subject: Re: Random Input-Size and recognizing ENTER-press
Date: 19 Dec 2004 17:03:51 +0100
Date: 2004-12-19T17:03:51+01:00 [thread overview]
Message-ID: <uis6yxok8.fsf@obry.net> (raw)
In-Reply-To: qBhxd.4359$RH4.2409@newsread1.news.pas.earthlink.net
Jeffrey Carter <spam@spam.com> writes:
> You might want to take a look at the source for Ada.Strings.Unbounded from
> GNAT before advocating an approach such as this. Every addition of a
> Character allocates a new String, copies the old String + new Character into
> the new String, and deallocates the old String. For a string of N
> Characters, that's N allocations and deallocations. Using Get_Line to obtain
> the Characters can improve that to N / Buffer'Length + 1.
That's not right. There is a buffer that is allocated when there is no more
space into an Unbounded_String. So there is far less that N allocation when
adding N characters into an Unbounded_String.
Pascal.
--
--|------------------------------------------------------
--| Pascal Obry Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--| http://www.obry.org
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595
next prev parent reply other threads:[~2004-12-19 16:03 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-12-19 8:44 Random Input-Size and recognizing ENTER-press xadian
2004-12-19 14:50 ` Marius Amado Alves
2004-12-19 16:01 ` Jeffrey Carter
2004-12-19 16:03 ` Pascal Obry [this message]
2004-12-19 23:47 ` Jeffrey Carter
2004-12-20 14:36 ` Steve
2004-12-20 23:45 ` Jeffrey Carter
2004-12-19 15:52 ` Jeffrey Carter
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox