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-Thread: 103376,80bc3e0698be468f X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Jan Andres Newsgroups: comp.lang.ada Subject: Re: Type safety on wikipedia Date: Sat, 28 Jan 2006 01:48:27 +0000 (UTC) Organization: home.jan Message-ID: 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> <15595105.IY1iVEeMMt@linux1.krischik.com> X-Trace: news.uni-berlin.de 3lM4KxUqELKbbt4k9r63HAXKX4klkDZSMpTwbeOltarA== X-Orig-X-Complaints-To: jandres@gmx.net X-Orig-X-Trace: pitr.home.jan 1138412907 7202 127.0.0.1 (28 Jan 2006 01:48:27 GMT) X-Orig-Path: pitr.home.jan!not-for-mail User-Agent: slrn/0.9.8.1 (Linux) Xref: g2news1.google.com comp.lang.ada:2693 Date: 2006-01-28T01:48:27+00:00 List-Id: On 2006-01-27, Martin Krischik wrote: > 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; Hmm, but aren't all the restrictions on the scope of access values actually there in order to guarantee type safety, as long as no unsafe constructs like 'Unchecked_Access are used? Or is Unchecked_Deallocation itself considered to be such an unsafe construct? If so, is there any "safe" alternative in Ada that we can use if we don't have GC? Of course you could simply avoid such constructs as quoted above but the downside is that the language will not actually enforce this. Regards -- Jan Andres