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 autolearn=unavailable autolearn_force=no version=3.4.4 Path: border1.nntp.dca3.giganews.com!border2.nntp.dca3.giganews.com!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!usenet.blueworldhosting.com!feeder02.blueworldhosting.com!news.ripco.com!rahul.net!wasp.rahul.net!rahul.net!news.kjsl.com!newsfeed-00.mathworks.com!nntp.TheWorld.com!.POSTED!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: 4 beginner's questions on the PL Ada Date: Fri, 09 Aug 2013 20:19:14 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <87ob96ajv6.fsf@VLAN-3434.student.uu.se> <03ea570b-e45f-4694-ab9b-3413c4770379@googlegroups.com> <878v0aee8i.fsf@VLAN-3434.student.uu.se> <87ob96cxm8.fsf@VLAN-3434.student.uu.se> <92c32083-74f2-4aaa-94cc-9c9e882bfdf4@googlegroups.com> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls7.std.com 1376093954 27650 192.74.137.71 (10 Aug 2013 00:19:14 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Sat, 10 Aug 2013 00:19:14 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:25PlGtF6aGFOdXJ6xDznEEoYhyg= X-Original-Bytes: 2843 Xref: number.nntp.dca.giganews.com comp.lang.ada:182920 Date: 2013-08-09T20:19:14-04:00 List-Id: Alan Jump writes: > So what you have shown here is a classic recipe for a memory leak. Yes. >... That strikes me as poor code design in any language. Right. My example was not meant to illustrate how to avoid memory leaks or any other good design principles -- just to show an example about the Image function on Task_Ids, and their uniqueness in particular. > Turning back to the point at hand, it seems to me that a better > example would have been to allocate an array of task types, then > examine the 'Image(Current_Task). But then, if one did produce the > array of task types, one would then use the array index as the unique > task name, yes? It depends. As I suggested, read the docs. Sometimes the array index is included in the Image. Yes, an array might have been a better example (to avoid getting side-tracked on the memory-leak issue), but I think it would have to be an array of *pointers* to tasks, not an array of tasks, to illustrate my point about Image. By the way, we're talking about Image, not 'Image. That is, the Image function, not the 'Image attribute. > Pardon me whilst I wander off to find more coffee. Something tells me > I'm going to need it. You're a Java programmer, so there ought to be some apt pun involving coffee/java here, but it's escaping me at the moment. ;-) - Bob