From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,5bd51db1b3bd8a14 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-07-13 00:21:08 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!newsfeeds.belnet.be!news.belnet.be!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!fu-berlin.de!news.uar.net!carrier.kiev.ua!news.kiev.sovam.com!Svitonline.COM!not-for-mail From: "Maxim Reznik" Newsgroups: comp.lang.ada Subject: Re: how to get aliased string pointer Date: Fri, 13 Jul 2001 10:19:24 +0300 Organization: Svit Online (post does not reflect views of Golden Telecom) Message-ID: <9im7h0$2q1m$1@news.kiev.sovam.com> References: <9ik3a4$1pd8$1@news.kiev.sovam.com> <3B4DDC16.9A98559B@boeing.com> NNTP-Posting-Host: 212.109.37.91 X-Trace: news.kiev.sovam.com 995008865 92214 212.109.37.91 (13 Jul 2001 07:21:05 GMT) X-Complaints-To: abuse@svitonline.com NNTP-Posting-Date: 13 Jul 2001 07:21:05 GMT X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2479.0006 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2479.0006 Xref: archiver1.google.com comp.lang.ada:9901 Date: 2001-07-13T07:21:05+00:00 List-Id: "Jeffrey Carter" 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