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,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-07-31 02:57:51 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!nntp.cs.ubc.ca!freenix!proxad.net!newsfeed.stueberl.de!newsfeed.vmunix.org!news-FFM2.ecrc.net!news.iks-jena.de!not-for-mail From: Lutz Donnerhacke Newsgroups: comp.lang.ada Subject: Elegant 'realloc'? Date: Thu, 31 Jul 2003 09:57:51 +0000 (UTC) Organization: IKS GmbH Jena Message-ID: NNTP-Posting-Host: taranis.iks-jena.de X-Trace: branwen.iks-jena.de 1059645471 23231 217.17.192.37 (31 Jul 2003 09:57:51 GMT) X-Complaints-To: usenet@iks-jena.de NNTP-Posting-Date: Thu, 31 Jul 2003 09:57:51 +0000 (UTC) User-Agent: slrn/0.9.7.4 (Linux) Xref: archiver1.google.com comp.lang.ada:41066 Date: 2003-07-31T09:57:51+00:00 List-Id: 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? declare procedure Free is new Unchecked_Deallocation(T_Array, T_Array_Access); oldp : constant T_Array_Access := current.field; begin current.field := new T_Array'(oldp(oldp'First .. current.last)); Free(oldp); end;