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,ddba2f4eebde1467 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-07-31 07:59:02 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!skynet.be!skynet.be!news-FFM2.ecrc.net!news.iks-jena.de!not-for-mail From: Lutz Donnerhacke Newsgroups: comp.lang.ada Subject: Re: Elegant 'realloc'? Date: Thu, 31 Jul 2003 14:59:01 +0000 (UTC) Organization: IKS GmbH Jena Message-ID: References: <1ec946d1.0307310642.74d93921@posting.google.com> NNTP-Posting-Host: taranis.iks-jena.de X-Trace: branwen.iks-jena.de 1059663541 2403 217.17.192.37 (31 Jul 2003 14:59:01 GMT) X-Complaints-To: usenet@iks-jena.de NNTP-Posting-Date: Thu, 31 Jul 2003 14:59:01 +0000 (UTC) User-Agent: slrn/0.9.7.4 (Linux) Xref: archiver1.google.com comp.lang.ada:41080 Date: 2003-07-31T14:59:01+00:00 List-Id: * Matthew Heaney wrote: > Lutz Donnerhacke wrote in message news:... >> When dealing with dynamically allocated variable length arrays, the >> allocated space might change. Is there a common idiom to simulate an >> 'realloc' (especially shrinking) other than, allocate, copy, free? > > I don't know how to implement a realloc in Ada, unless you write your own > storage pool. Any hint? > You can try using the vector container in Charles, which hides all the > allocate, copy, and free calls. Performance does matter in this case. So hiding necessary parts does not help. > The length of the vector refers to the number of active elements in the > vector. The size of the vector refers to the length of the underlying > array, which is at least the number of elements. Exactly this is the way I implement it: Trading allocated space for running time.