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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ed6a891101ff4e06 X-Google-Attributes: gid103376,public From: dewarr@my-dejanews.com Subject: Re: Freeing Pointers to classwide types Date: 1998/09/28 Message-ID: <6umkl8$qbm$1@nnrp1.dejanews.com>#1/1 X-Deja-AN: 395443918 References: <1ftmFTC69GA.191@samson.airnet.net> <360b26a1.41575272@SantaClara01.news.InterNex.Net> <6ugeu2$79u$1@nnrp1.dejanews.com> <360c4a70.29707515@SantaClara01.news.InterNex.Net> <6uifpt$e98$1@nnrp1.dejanews.com> <360d1380.165146@SantaClara01.news.InterNex.Net> <6ulj29$ne3$1@nnrp1.dejanews.com> <360e790d.241368@SantaClara01.news.InterNex.Net> X-Http-Proxy: 1.0 x5.dejanews.com:80 (Squid/1.1.22) for client 209.73.133.253 Organization: Deja News - The Leader in Internet Discussion X-Article-Creation-Date: Mon Sep 28 00:18:48 1998 GMT Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/2.02 (OS/2; I) Date: 1998-09-28T00:00:00+00:00 List-Id: In article <360e790d.241368@SantaClara01.news.InterNex.Net>, tmoran@bix.com (Tom Moran) wrote: > >This can be done with access discriminants, but the most normal way of doing > >things is to make the pointer finalizable. > Neither of which works in the case under discussion, where the access > type was declared inside a procedure and thus after the (global) type > definition. > I quite agree that Ada is a powerful language in which you can find > a way to do almost anything - but sometimes it takes a substantial > change in the design ( "make the pointer finalizable") to accomplish > the goal. It's usually also true that a new design is in fact much > better than the one that painted you into a corner. But in this case > it seems to me you are saying "do a big redesign, possibly affecting > any package that uses this type, in which a bunch of stuff is made > global and complex, instead of local and straightforward, or take the > risk of a major storage leak, or use unchecked programming". It might > even make a person include "no storage leak in this case" as a > criterion in choosing one compiler over another. You say it's > expensive to not have a storage leak in this case. Why? Do there > exist compilers that do leak? You've said Gnat doesn't leak - are > there plans to change that? No, there are no plans to change the *default* but as I have said before, GNAT provides a choice in this respect. Consult the GNAT documentation for details! Any code that *assumes* this kind of automatic collection is badly flawed and non-portable. As always, most portability problems in Ada are caused by incompetent programming. As for major redesign, no, that's not required, it is actually quite easy in Ada 95 to do exactly what you want. You probably aren't familiar with the Storage_Pool facility -- many Ada programmers don't know this very powerful feature in the language well enough, but read up on it, you will find it allows you to do exactly what you want in a completely portable manner. By the way, relatively few compilers have done this kind of automatic free operation, so it is fairly rare to find code that makes the mistake of assuming that this is done. -----== Posted via Deja News, The Leader in Internet Discussion ==----- http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum