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!news1.google.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: "Alex R. Mosteo" Newsgroups: comp.lang.ada Subject: Re: Type safety on wikipedia Date: Thu, 26 Jan 2006 16:18:52 +0100 Message-ID: <43D8E85C.6020805@mailinator.com> References: <1138260496.230283.147640@g43g2000cwa.googlegroups.com> <1138283608.433842.76060@z14g2000cwz.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net sLlR/ZkLpAoMtgSwFp1cIQU+uMa1dDJWt+B1fNZ2L7dG00i5E= User-Agent: Mozilla Thunderbird 1.0.7 (X11/20051013) X-Accept-Language: en-us, en In-Reply-To: <1138283608.433842.76060@z14g2000cwz.googlegroups.com> Xref: g2news1.google.com comp.lang.ada:2649 Date: 2006-01-26T16:18:52+01:00 List-Id: jimmaureenrogers@worldnet.att.net wrote: > I do not see how Unchecked_Deallocation interferes with type safety. > Ada access types are typed. There is no Ada equivalent to a C void*. An > Ada access type cannot be made to point to an object of some foreign > type. For instance, > > type Integer_Access is access Integer; > > An instance of Integer_Access cannot reference a task, or a real > number, or some record type. Garbage collection cannot improve type > safety in Ada or any other language. It can only automate the process > of deallocating dynamically allocated objects. Well, the argument given in the discussion is like this: you allocate a pointer, make some aliases and free one of them. Further allocations (presumibly unrelated) reuse the same heap area. You can now use a dangling pointer not correctly deallocated pointing to a valid memory area within the program, but holding completely unrelated data (from other types, probably). Obviously, in a GCed language, no memory area can be reallocated as long as any reference to it is still alive. There's a glaring affirmation in the article (not discussion) saying that Ada is type safe, with ML. So I wonder.