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=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.152.29.169 with SMTP id l9mr4456150lah.3.1404150929428; Mon, 30 Jun 2014 10:55:29 -0700 (PDT) Path: border1.nntp.dca.giganews.com!nntp.giganews.com!c11no23158547lbj.0!news-out.google.com!kx1ni3103lbc.1!nntp.google.com!goblin3!goblin.stu.neva.ru!news.ripco.com!news.glorb.com!peer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post01.iad.highwinds-media.com!fx31.iad.POSTED!not-for-mail From: Shark8 User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:32.0) Gecko/20100101 Thunderbird/32.0a1 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Function definitions - with clarification References: <53b12e15$0$6610$9b4e6d93@newsspool4.arcor-online.net> In-Reply-To: <53b12e15$0$6610$9b4e6d93@newsspool4.arcor-online.net> Message-ID: X-Complaints-To: abuse@teranews.com NNTP-Posting-Date: Mon, 30 Jun 2014 17:55:28 UTC Organization: TeraNews.com Date: Mon, 30 Jun 2014 11:55:27 -0600 X-Received-Bytes: 1644 X-Received-Body-CRC: 1465638676 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Xref: number.nntp.dca.giganews.com comp.lang.ada:187291 Date: 2014-06-30T11:55:27-06:00 List-Id: On 30-Jun-14 03:29, G.B. wrote: >> procedure EA (P1,Q1,R1,Popsize : Natural) is >> >> type vi is access Individual; >> V : vi := new Individual (P=>P1,Q=>Q1,R=>R1); >> type population is array (1 .. Popsize) of vi; >> begin >> V.Y(1) := 1; >> end EA; > Regarding resource management, I'd now consider, e.g., deriving > type Individual from Finalization.Controlled. By overriding > the primitive operation Finalize you could then have the > memory of V deallocated automatically, when EA exits. Isn't this unneeded? Given that the access-type is local to the function, when the function goes out of scope [due returning] the access-type itself should as well, taking all the allocated values with it, right?