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 autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,965fbd9798ca1677 X-Google-Attributes: gid103376,public From: Brian Rogoff Subject: Re: Return by reference Date: 1999/11/06 Message-ID: #1/1 X-Deja-AN: 545452293 References: Content-Type: TEXT/PLAIN; charset=US-ASCII X-Trace: nntp1.ba.best.com 941957807 206 bpr@206.184.139.136 MIME-Version: 1.0 Newsgroups: comp.lang.ada Date: 1999-11-06T00:00:00+00:00 List-Id: On 4 Nov 1999, Lutz Donnerhacke wrote: > * Brian Rogoff wrote: > >Thanks for the code, but I already know how to do this with a type whose > >public view is limited and its private view, not limited. I was wondering > >if I can do this entirely with minimal potential copying. > > Of course it is possible. The idea is to deal with a pointer to a dynamic > array only. The Format function allocates and the To_String function > releases the memory. But then you have to heap allocate. That seems rather heavy. I think Matthew Heaney's suggestion is the most promising for reducing copying, but it appears too "naughty" to me. I'll just live with the copying. --Brian