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=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,5cb36983754f64da X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-04-03 07:09:14 PST Path: archiver1.google.com!news1.google.com!news.glorb.com!news.moat.net!border1.nntp.sjc.giganews.com!nntp.giganews.com!local1.nntp.sjc.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail NNTP-Posting-Date: Sat, 03 Apr 2004 09:09:13 -0600 Date: Sat, 03 Apr 2004 10:09:12 -0500 From: "Robert I. Eachus" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: No call for Ada (was Re: Announcing new scripting/prototyping language) References: <20040206174017.7E84F4C4114@lovelace.ada-france.org> <54759e7e.0402071124.322ea376@posting.google.com> <87r7v5zao0.fsf@insalien.org> <6803831.c4KqqVc08g@linux1.krischik.com> In-Reply-To: <6803831.c4KqqVc08g@linux1.krischik.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: NNTP-Posting-Host: 24.128.39.153 X-Trace: sv3-04gi4c5iB+JifbW3xiiOxI6j6JyvhcPTn381h6Ilnfk3zdvzdGIDX7tk/FJzZXs59wGB/paLfDiZmvw!W1LYdJP+ki5XGHxZT/Ctr+YasoMzLU0hBS5ZNtfn92y5EgBIgP2dy77Y4ZXrQg== X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Xref: archiver1.google.com comp.lang.ada:6726 Date: 2004-04-03T10:09:12-05:00 List-Id: Martin Krischik wrote: > Wich reminds me. Does anybody know what - should - happen when: > > Access_X is access X; > All_X is access all X; > > for Access_X'Pool use Access_Pool; > for All_X'Pool use All_Pool; > > Some_X : Access_X := new X; > Another_X : All_X := Some_X; > > function Deallocate is new Unchecked_Deallocation (X, All_X); > > begin > Deallocate (Another_X); > end; No. The execution of the call to Deallocate is erroneous. That means that anything can happen: RM 13.11.2(16) "The execution of a call to an instance of Unchecked_Deallocation is erroneous if the object was created other than by an allocator for an access type whose pool is Name'Storage_Pool." The proper thing to do is to do the necessary check inside your Deallocate. Unfortunately, there is no language defined attribute that can be used to determine the storage pool associated with an access object. Of course, if you define a storage pool, you can also provide such an operation: function Storage_Pool_Of(X: Address) return Root_Storage_Pool'Class; But it would be nice to have 'Storage_Pool defined for both subtypes (as at present) and for all access objects. That way you could do the necessary check to see whether access values denote an object in the default storage pool. In fact, it might be better to have both 'Storage_Pool, and 'Allocated, where Object'Allocated returns a boolean. ('Storage_Pool should raise an exception if called with a parameter that does not belong to any storage pool.) Or perhaps we could add a value: No_Storage_Pool: constant Root_Storage_Pool; to System.Storage_Pools. However, in the meantime, the best policy is probably to only instantiate Unchecked_Deallocation for types which are not declared access all. -- Robert I. Eachus "The terrorist enemy holds no territory, defends no population, is unconstrained by rules of warfare, and respects no law of morality. Such an enemy cannot be deterred, contained, appeased or negotiated with. It can only be destroyed--and that, ladies and gentlemen, is the business at hand." -- Dick Cheney