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,80bc3e0698be468f X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!news.glorb.com!newsfeed.pionier.net.pl!news-fra1.dfn.de!newscore.univie.ac.at!newsfeed.inode.at!news.hispeed.ch!linux2.krischik.com!news From: Martin Krischik Newsgroups: comp.lang.ada Subject: Re: Type safety on wikipedia Date: Fri, 27 Jan 2006 19:54:33 +0100 Organization: Cablecom Newsserver Message-ID: <15595105.IY1iVEeMMt@linux1.krischik.com> References: <1138260496.230283.147640@g43g2000cwa.googlegroups.com> <1138283608.433842.76060@z14g2000cwz.googlegroups.com> <87fynaajuh.fsf@mid.deneb.enyo.de> <1138322309.525464.253320@z14g2000cwz.googlegroups.com> NNTP-Posting-Host: 84-74-134-212.dclient.hispeed.ch Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: news.hispeed.ch 1138389303 30509 84.74.134.212 (27 Jan 2006 19:15:03 GMT) X-Complaints-To: news@hispeed.ch NNTP-Posting-Date: Fri, 27 Jan 2006 19:15:03 +0000 (UTC) User-Agent: KNode/0.10 Xref: g2news1.google.com comp.lang.ada:2683 Date: 2006-01-27T19:54:33+01:00 List-Id: jimmaureenrogers@worldnet.att.net wrote: > > Florian Weimer wrote: >> Now, suppose that X is a pool-specific access value for some type T, >> and Free is a corresponding instance of Ada.Unchecked_Deallocation. >> Suppose that >> >> >> Free (X); >> >> has just been exected. Suppose the next thing to be evaluated is >> >> declare >> Y : T := X.all; >> begin >> ... > > > Let's look at an actual program doing an equivalent action: > with Ada.Text_Io; > > procedure Access_Test is > type Int_Access is access Integer; > P : Int_Access; > begin > P := null; > Ada.Text_Io.Put_Line(Integer'Image(P.All)); > end Access_Test; Make that with Ada.Text_Io; procedure Access_Test is type Int_Access is access Integer; procedure Deallocate is new Unchecked_Deallocation .... P : Int_Access := new Integer; Q : Int_Access := P; begin Deallocate (P); Ada.Text_Io.Put_Line(Integer'Image(Q.All)); end Access_Test; That is what the garbage collection chapter of the article is all about. For a type save language behavior of this code snippet must be well defined. But in Ada it is not. Martin -- mailto://krischik@users.sourceforge.net Ada programming at: http://ada.krischik.com