comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R. Carter" <spam.jrcarter.not@spam.acm.org>
Subject: Re: Deallocation of Unbounded_String
Date: Sat, 25 Jul 2009 12:17:45 -0700
Date: 2009-07-25T12:17:45-07:00	[thread overview]
Message-ID: <h4floq$1d25$1@news.ett.com.ua> (raw)
In-Reply-To: b3e58bec-89fe-4f8a-a4d8-470d618a3c65@b14g2000yqd.googlegroups.com

vlc wrote:
 >
 > when using Unbounded_String, is it necessary to deallocate instances
 > of Unbounded_String after use or is there a kind of garbage collector
 > implemented?

The "Implementation Requirements" of ARM A.4.5(88) say, "No storage associated
with an Unbounded_String object shall be lost upon assignment or scope exit."
This means the user doesn't have to worry about it; objects of the type take
care of their own memory management. [ARM A.4.5(72.1/2, "The type
Unbounded_String needs finalization (see 7.6)," gives you a clue about how this
is probably done.]

 > There is a "Free" function in Ada.Strings.Unbounded, but it takes an
 > access to String as argument, not an access to Unbounded_String.

That and the type String_Access have nothing to do with Unbounded_String, and
really shouldn't be there. The likely explanation for them is that
implementations were expected to use access-to-String, and it was thought that
these declarations would be generally useful. Even then, they would be better
off in Ada.Strings than in Ada.Strings.Unbounded.

-- 
Jeff Carter
"If a sperm is wasted, God gets quite irate."
Monty Python's the Meaning of Life
56



      parent reply	other threads:[~2009-07-25 19:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-25 16:37 Deallocation of Unbounded_String vlc
2009-07-25 17:09 ` sjw
2009-07-25 17:16   ` vlc
2009-07-25 17:18 ` Yannick Duchêne Hibou57
2009-07-25 19:17 ` Jeffrey R. Carter [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox