comp.lang.ada
 help / color / mirror / Atom feed
From: "Nick Roberts" <nickroberts@callnetuk.com>
Subject: Re: ada.strings.unbounded "free" and "String_Access"
Date: 2000/03/08
Date: 2000-03-08T00:00:00+00:00	[thread overview]
Message-ID: <38c6de74@eeyore.callnetuk.com> (raw)
In-Reply-To: 38C5B5AD.D310C559@mindspring.com

The purpose is simply this: if Unbounded_String doesn't give you quite
enough flexibility in certain parts of your code (e.g. you need more speed),
you can use the type String_Access instead.

You may well employ the following strategy: convert value(s) of type
Unbounded_String to type String_Access (using the To_String function and the
'new' allocator); operate on the String_Access object(s) as required;
convert the result(s) back to type Unbounded_String (using the
To_Unbounded_String function).

This way, you can use the more encapsulated type Unbounded_String in most of
your code, and only use the lower-level String_Access type where you really
need to. The function Free is provided for you to explicitly deallocate the
String_Access object(s) if you want to (or need to).

Really, the type String_Access, and the function Free, are provided purely
as a convenience. They could easily have been omitted (to be declared
incidentally instead), but that was obviously felt to be just a little too
inconvenient by the designers of Ada 95 (and I agree with them).

--
Nick Roberts
http://www.adapower.com/lab/adaos

"Al Johnston" <sofeise@mindspring.com> wrote in message
news:38C5B5AD.D310C559@mindspring.com...
> ...
> But  I was wondering...  why is the type "ada.strings.
> unbounded.string_access" as well as a "free" routine
> for this type, provided in the spec of unbounded.strings?







  parent reply	other threads:[~2000-03-08  0:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-03-07  0:00 ada.strings.unbounded "free" and "String_Access" Al Johnston
2000-03-08  0:00 ` Robert A Duff
2000-03-08  0:00 ` Nick Roberts [this message]
2000-03-08  0:00   ` Jeff Carter
2000-03-10  0:00     ` Ted Dennison
2000-03-11  0:00   ` Robert A Duff
2000-03-13  0:00     ` Robert Dewar
2000-03-09  0:00 ` Al Johnston
replies disabled

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