From: "Maxim Reznik" <max1@mbank.com.ua>
Subject: Re: how to get aliased string pointer
Date: Fri, 13 Jul 2001 10:19:24 +0300
Date: 2001-07-13T07:21:05+00:00 [thread overview]
Message-ID: <9im7h0$2q1m$1@news.kiev.sovam.com> (raw)
In-Reply-To: 3B4DDC16.9A98559B@boeing.com
"Jeffrey Carter" <jeffrey.carter@boeing.com> wrote in message news:3B4DDC16.9A98559B@boeing.com...
> The real question is what you are trying to acheive by this. The use of
> access types is rarely needed in well designed Ada, and over use of
> access values is a common sign of writing Ada with the C mind set, since
> in C practically everything has to be a pointer. If you can tell us what
> you need to do at the problem level, we can probably help you achieve it
> Ada, probably without access values.
>
> --
> Jeffrey Carter
Actualy the question is theoretical one.
Is it possible to convert access to constrained array to unconstrained access type?
A couple weeks ago I tried to make more efficient impementation of Unbounded_String.
I posted message to CLA and was pointed to lack of task synchronization.
I introduced protected object to fix it. Trying to use new Unbounded_String I encountered
child unit Ada.Strings.Unbounded.Aux. The point is that using
function To_String(Unbounded_String) return String is an unefficient way to access String.
People of ACT made a hole (function Get_String (U : Unbounded_String) return String_Access) to
lighten access. Here is their comments
-- This child package of Ada.Strings.Unbounded provides some specialized
-- access functions which are intended to allow more efficient use of the
-- facilities of Ada.Strings.Unbounded, particularly by other layered
-- utilities (such as GNAT.Patterns).
So I'm playing with pointer to emulate GNAT behavior.
(Is this enough well designed?)
I thouth it's easy to impement such function returning acess to aliased
component of my record type Shared_String. But it seems the component
has constrained type and I cant convert pointer to it to unconstrained access type.
--
Maxim Reznik
prev parent reply other threads:[~2001-07-13 7:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-07-12 11:55 how to get aliased string pointer Maxim Reznik
2001-07-12 17:19 ` Jeffrey Carter
2001-07-13 7:19 ` Maxim Reznik [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