comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Using generic package to store and retrieve string data
Date: Sat, 8 Oct 2016 12:17:42 +0200
Date: 2016-10-08T12:17:42+02:00	[thread overview]
Message-ID: <ntah48$1kpt$1@gioia.aioe.org> (raw)
In-Reply-To: ly8ttz1af2.fsf@pushface.org

On 2016-10-08 11:01, Simon Wright wrote:
> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes:
>
>> On 2016-10-08 01:11, Jeffrey R. Carter wrote:
>>
>>> If your Strings may have differing lengths, then you should either
>>> use Unbounded_String or one of the indefinite containers.
>>
>> Unbounded_String is not self-contained. Normally it is important for a
>> stack and containers to have this.
>
> It looks self-contained to me. (I mean, if I 'with
> Ada.Strings.Unbounded' I can pretty-much use it without further ado;
> just a little complication with translating to/from String).

The string body will be allocated in the pool not on the stack. That, 
not always, but usually defeats the purpose of having a stack of strings.

>> IMO, the best way to implement an indefinite elements LIFO is on top
>> of a custom memory pool.
>
> I doubt this is going to help the OP.

My comment was addressed to Jeffrey's about indefinite elements. (The OP 
wanted fixed strings)

A stack of indefinite objects sitting on the stack would require either 
custom allocation or custom serialization (e.g. using stream 
attributes). In both cases it is important to grow the stack towards 
lesser addresses/indices to have access to the beginning of the last 
element.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

  reply	other threads:[~2016-10-08 10:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-07 21:30 Using generic package to store and retrieve string data James Brewer
2016-10-07 23:11 ` Jeffrey R. Carter
2016-10-08  7:42   ` Dmitry A. Kazakov
2016-10-08  9:01     ` Simon Wright
2016-10-08 10:17       ` Dmitry A. Kazakov [this message]
2016-10-08 16:07         ` Jeffrey R. Carter
2016-10-08 16:21 ` Stephen Leake
replies disabled

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