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=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,5a9bede4d09438a9 X-Google-Attributes: gid103376,public From: Pawel Kobylarz Subject: Re: Unbounded array Date: 1999/04/27 Message-ID: <37262C39.D4F16DD8@wbkst21.mach.uni-karlsruhe.de>#1/1 X-Deja-AN: 471627847 Content-Transfer-Encoding: 7bit References: <37247AA2.116F5E00@wbkst21.mach.uni-karlsruhe.de> <7g23a9$k3k$1@nnrp1.dejanews.com> Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@rz.uni-karlsruhe.de X-Trace: news.rz.uni-karlsruhe.de 925248569 19667 129.13.175.21 Organization: University of Karlsruhe Mime-Version: 1.0 Reply-To: kobylarz@wbkst21.mach.uni-karlsruhe.de Newsgroups: comp.lang.ada Date: 1999-04-27T00:00:00+00:00 List-Id: Robert Dewar wrote: > In article > <37247AA2.116F5E00@wbkst21.mach.uni-karlsruhe.de>, > kobylarz@wbkst21.mach.uni-karlsruhe.de wrote: > > Is there in ADA a way to obtain something like unbouned > > array? > > Well most certainly you can use EXACTLY the same procedure > you use in C (lookup allocators and the NEW keyword in your > Ada text book). > > But if you are using GNAT, also look up GNAT.Table (in file > g-table.ads) which provides exactly the abstraction you are > looking for. > > -----------== Posted via Deja News, The Discussion Network ==---------- > http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own Maybe my textbook is incomplete, maybe there was a misunderstanding because I gave wrong description of realloc function. Using new and unchecked_deallocation, I can change the size of array by allocating new array, copy the objects and deallocate the old one. This is not efficient. Realloc function takes two parameters, the actual pointer and new size, and it preserves the data already present in the memory block. Realloc is more efficient than allocate-copy-deallocate, because it can add a piece of memory without moving existing data if there is place after the existing block. In my textbook, I found only operators new and unchecked deallocation, nothing similar to realloc(). Is there in ADA something like realloc? Pawel Kobylarz