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.3 required=5.0 tests=BAYES_00,INVALID_MSGID, MSGID_RANDY autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,51b151b4d322b1cc X-Google-Attributes: gid103376,public From: Ted Dennison Subject: Re: ada.strings.unbounded "free" and "String_Access" Date: 2000/03/10 Message-ID: <8a9gc6$dlb$1@nnrp1.deja.com>#1/1 X-Deja-AN: 595399397 References: <38C5B5AD.D310C559@mindspring.com> <38c6de74@eeyore.callnetuk.com> <38C6D4DE.D482DA0C@acm.org> X-Http-Proxy: 1.0 x23.deja.com:80 (Squid/1.1.22) for client 204.48.27.130 Organization: Deja.com - Before you buy. X-Article-Creation-Date: Fri Mar 10 00:41:43 2000 GMT X-MyDeja-Info: XMYDJUIDtedennison Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.7 [en] (WinNT; I) Date: 2000-03-10T00:00:00+00:00 List-Id: In article <38C6D4DE.D482DA0C@acm.org>, jrcarter@acm.org wrote: > Nick Roberts wrote: > > > > 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 don't need an access type for this (in Ada, you rarely need access > types at all). You can simply operate on the String returned by > To_String: You miss Nick's point. Doing that would cause the entire contents of the string to get copied. For a somewhat longish string, passing the pointer of the String_Access around instead would be significantly faster. I just yesterday had to perform that very optimization in some code of ours that is running at 60Hz with hard realtime performance requirements. -- T.E.D. http://www.telepath.com/~dennison/Ted/TED.html Sent via Deja.com http://www.deja.com/ Before you buy.