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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,71c743c03ed191fe X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-09-19 07:15:07 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!canoe.uoregon.edu!logbridge.uoregon.edu!uunet!sea.uu.net!ash.uu.net!spool0900.news.uu.net!reader0901.news.uu.net!not-for-mail Date: Thu, 19 Sep 2002 10:17:02 -0400 From: Hyman Rosen User-Agent: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:1.1) Gecko/20020826 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Beginer problem: variable array size References: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Organization: KBC Financial Products Message-ID: <1032444904.302364@master.nyc.kbcfp.com> Cache-Post-Path: master.nyc.kbcfp.com!unknown@mosquito.nyc.kbcfp.com X-Cache: nntpcache 3.0.1 (see http://www.nntpcache.org/) NNTP-Posting-Host: 204.253.250.10 X-Trace: 1032444904 reader1.ash.ops.us.uu.net 2487 204.253.250.10 Xref: archiver1.google.com comp.lang.ada:29172 Date: 2002-09-19T10:17:02-04:00 List-Id: Robert A Duff wrote: > "Nacho" writes:n >>The solution in c++ is easy as I posted before. Simply free the memory and >>reserve new memory to hold the new size of the array.n > > The solution is what Ludovic Brenta said: you do essentially the > same as in C++ -- you deallocate and reallocate the array. > > And Pascal Obry gave good advice to encapsulate this in an abstraction.n And in C++, you would not be playing with the memory yourself, because C++ already provides the abstraction for you. It's called std::vector.