comp.lang.ada
 help / color / mirror / Atom feed
From: Shark8 <OneWingedShark@gmail.com>
Subject: Re: Function definitions - with clarification
Date: Mon, 30 Jun 2014 11:55:27 -0600
Date: 2014-06-30T11:55:27-06:00	[thread overview]
Message-ID: <kwhsv.61654$D44.51932@fx31.iad> (raw)
In-Reply-To: <53b12e15$0$6610$9b4e6d93@newsspool4.arcor-online.net>

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?


  reply	other threads:[~2014-06-30 17:55 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-22 11:34 Function definitions - with clarification montgrimpulo
2014-06-22 12:04 ` Simon Clubley
2014-06-22 14:25 ` montgrimpulo
2014-06-22 15:30 ` Georg Bauhaus
2014-06-22 17:29 ` montgrimpulo
2014-06-22 17:45 ` Shark8
2014-06-22 18:03   ` montgrimpulo
2014-06-22 18:45     ` Simon Clubley
2014-06-22 19:28       ` montgrimpulo
2014-06-22 21:04         ` Simon Wright
2014-06-22 21:17       ` Jeffrey Carter
2014-06-22 19:55     ` Shark8
2014-06-23 16:26 ` Adam Beneschan
2014-06-29 15:31 ` cotswold
2014-06-29 19:20 ` montgrimpulo
2014-06-30  9:29   ` G.B.
2014-06-30 17:55     ` Shark8 [this message]
2014-07-01  8:58       ` Georg Bauhaus
2014-07-04  6:45         ` J-P. Rosen
2014-06-30 13:23 ` montgrimpulo
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox