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.1 required=5.0 tests=BAYES_00, PP_MIME_FAKE_ASCII_TEXT autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,71c743c03ed191fe X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-09-15 09:17:42 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.cwix.com!nsnmpen1-lo.nuria.telefonica-data.net!nsnmpen2-lo.nuria.telefonica-data.net!not-for-mail From: "Nacho" Newsgroups: comp.lang.ada Subject: Re: Beginer problem: variable array size Date: Sun, 15 Sep 2002 18:16:51 +0200 Organization: Telefonica Data Espagna Message-ID: References: NNTP-Posting-Host: 213-99-75-108.uc.nombres.ttd.es X-Trace: nsnmpen2-gest.nuria.telefonica-data.net 1032106629 8693 213.99.75.108 (15 Sep 2002 16:17:09 GMT) X-Complaints-To: usenet@nsnmpen2-gest.nuria.telefonica-data.net NNTP-Posting-Date: Sun, 15 Sep 2002 16:17:09 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Xref: archiver1.google.com comp.lang.ada:28984 Date: 2002-09-15T18:16:51+02:00 List-Id: That does not resolve the problem. I need to change the size of the array after it has been created. With your solution once array_called_p has been created it will never change its size. I need this: ... preceding Ada statements declare -- scope of array_called_p type my_array_type is array ( positive range <> ) of integer; array_called_p : my_array_type ( 1 .. variable ); begin -- scope of array_called_p ... Ada statements that use array_called_p variable := variable+50; -- We increase the size of the array in 50 elementes .... HERE I need array_called_p to increase its size so it can hold 50 more elements end; -- scope of array_called_p ... following Ada statements 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. "Larry Kilgallen" escribi� en el mensaje news:HFiRcRlG5JiR@eisner.encompasserve.org... > In article , "Nacho" writes: > > Hi everyone! > > > > I am learning ada and i have to implement an array of unknown size until > > rutime. > > The array must be resizable at runtime. This is easy to achieve for me in > > other lenguajes like c++, but i am new to ada and i don't know hot to > > resolve the problem. The solution in c++ code could be: > > > > > > > > int variable=50; //let's make an array of 50 elements. > > int* p; //pointer to int, if the array is of integers. > > p=new int[variable]; //we reserve memory for 50 integers. > > > > > > .... //some code with the array here. > > > > delete [] p; //we free the allocated memory for the array. > > variable=80; //we change the size of the array. > > p=new int[variable]; //we have a new array with the new size. > > Wow, C looks like a lot of work !!!!! > > ... preceding Ada statements > > declare -- scope of array_called_p > type my_array_type is array ( positive range <> ) of integer; > array_called_p : my_array_type ( 1 .. variable ); > begin -- scope of array_called_p > ... Ada statements that use array_called_p > end; -- scope of array_called_p > > ... following Ada statements > > In general, Ada rarely requires pointers.