From: "jimmaureenrogers@worldnet.att.net" <jimmaureenrogers@worldnet.att.net>
Subject: Re: Type safety on wikipedia
Date: 26 Jan 2006 16:38:29 -0800
Date: 2006-01-26T16:38:29-08:00 [thread overview]
Message-ID: <1138322309.525464.253320@z14g2000cwz.googlegroups.com> (raw)
In-Reply-To: <87fynaajuh.fsf@mid.deneb.enyo.de>
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;
The problem is one of attempting to dereference a null access object.
The above program compiles without error.
When run, I get the following error message:
raised CONSTRAINT_ERROR: access_test.adb:8 access check failed
It appears that Ada's runtime checks detect an erroneous problem.
I would say that a program that terminates with a CONSTRAINT_ERROR
has not exhibited the same kind of improper behavior as a program that
does not detect the problem.
In C, while it is an error to de-reference a null pointer, the runtime
system
does nothing to detect the problem. C programs continue with really
nasty
garbage values.
Jim Rogers
next prev parent reply other threads:[~2006-01-27 0:38 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-26 7:28 Type safety on wikipedia Martin Krischik
2006-01-26 11:58 ` Alex R. Mosteo
2006-01-26 17:10 ` Martin Krischik
2006-01-26 20:24 ` Simon Wright
2006-01-26 20:43 ` Simon Wright
2006-01-27 6:58 ` Martin Krischik
2006-01-26 23:43 ` Bobby D. Bryant
2006-01-27 11:14 ` Alex R. Mosteo
2006-01-27 11:57 ` Martin Krischik
2006-01-27 15:30 ` Larry Kilgallen
2006-01-27 19:04 ` Martin Krischik
2006-01-27 22:06 ` Larry Kilgallen
2006-01-28 7:04 ` Martin Krischik
2006-01-29 21:48 ` Florian Weimer
2006-01-27 12:43 ` Georg Bauhaus
2006-01-26 13:49 ` Rod Chapman
2006-01-26 17:05 ` Martin Krischik
2006-01-26 18:14 ` Martin Krischik
2006-01-26 13:53 ` jimmaureenrogers
2006-01-26 15:18 ` Alex R. Mosteo
2006-01-26 16:49 ` Martin Krischik
2006-01-26 18:19 ` Alex R. Mosteo
2006-01-26 20:38 ` Simon Wright
2006-01-27 11:13 ` Alex R. Mosteo
2006-01-27 19:38 ` Simon Wright
2006-01-27 23:24 ` Randy Brukardt
2006-01-28 6:53 ` Martin Krischik
2006-01-27 18:58 ` Martin Krischik
2006-01-27 19:50 ` Simon Wright
2006-01-28 6:52 ` Martin Krischik
2006-01-26 19:22 ` Dmitry A. Kazakov
2006-01-26 19:07 ` Florian Weimer
2006-01-27 0:38 ` jimmaureenrogers [this message]
2006-01-27 18:54 ` Martin Krischik
2006-01-28 1:48 ` Jan Andres
2006-01-28 6:44 ` Martin Krischik
2006-01-31 2:13 ` Randy Brukardt
2006-02-06 5:02 ` Dave Thompson
2006-02-06 8:29 ` Larry Kilgallen
2006-01-27 11:34 ` Alex R. Mosteo
2006-01-27 12:18 ` Martin Krischik
2006-01-27 15:27 ` Florian Weimer
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox