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=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,5dacec64c8c879fa X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Received: by 10.68.213.68 with SMTP id nq4mr11499398pbc.2.1328544322938; Mon, 06 Feb 2012 08:05:22 -0800 (PST) Path: lh20ni267319pbb.0!nntp.google.com!news2.google.com!postnews.google.com!1g2000yqv.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: Preventing Unchecked_Deallocation? Date: Mon, 6 Feb 2012 08:05:22 -0800 (PST) Organization: http://groups.google.com Message-ID: References: <33a35da4-6c3e-4ab4-b58f-a9d73565d79a@t30g2000vbx.googlegroups.com> NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 X-Trace: posting.google.com 1328544322 4443 127.0.0.1 (6 Feb 2012 16:05:22 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 6 Feb 2012 16:05:22 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: 1g2000yqv.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-Header-Order: ARLUEHNKC X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; WOW64; Trident/4.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30618; .NET4.0C),gzip(gfe) Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Date: 2012-02-06T08:05:22-08:00 List-Id: On Feb 6, 4:52=A0am, Julian Leyh wrote: > On 5 Feb., 17:42, Simon Belmont wrote: > > > package ud is > > =A0 function Get return not null access Integer; > > end ud; > > > package body ud is > > =A0 type Int_Ptr is access all Integer; > > =A0 o : Int_Ptr :=3D new Integer'(42); > > use o : constant Int_Ptr :=3D .... Ummm, no. All that does is prevent the variable "o" from being modified inside the body of UD. That means that if Free is an instance of Unchecked_Deallocation, the body of UD can't call Free (o); but that doesn't prevent x :=3D o; -- where x is a variable Free (x); or x :=3D Get; Free (x); And "o" will point to a non-existing object. -- Adam