Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83 (MC840302); site boring.UUCP Path: utzoo!linus!philabs!cmcl2!seismo!mcvax!boring!steven From: steven@boring.UUCP Newsgroups: net.lang Subject: Re: Nil dereferencing protection Message-ID: <6299@boring.UUCP> Date: Wed, 30-Jan-85 09:45:48 EST Article-I.D.: boring.6299 Posted: Wed Jan 30 09:45:48 1985 Date-Received: Sun, 3-Feb-85 02:05:53 EST References: <2340@hplabsc.UUCP> <4948@utzoo.UUCP> <6292@boring.UUCP> <536@mako.UUCP> <338@harvard.ARPA> Reply-To: steven@boring.UUCP (Steven Pemberton) Distribution: net Organization: CWI, Amsterdam Lines: 21 Xref: seismo net.lang:1382 Apparently-To: rnews@mcvax.LOCAL Jim Davies@uiucdcsb.UUCP writes: > boring!steven states that it is possible to statically insure that nil > pointers are never dereferenced. The following program provides a simple > counterexample to this claim: [a Pascal program followed] and macrakis@harvard.ARPA (Stavros Macrakis) writes: > > > For instance, it is possible to statically guarantee that nil > > > pointers are never dereferenced --Pemberton > > Ada supports this... --Steinman > > Unfortunately, this is not and cannot be true. (consider "a := if > program P halts, then nil else new foo; deref(a)") Of course you can't do it without extra syntax! But strong typing is also impossible (consider int a; a:= if P halts then "hello" else 123). The point is, that it is possible to define a language so that it is possible statically to guarantee that nil is never dereferenced (Stavros's Ada example contains the germ of the idea). You can't do it in Vanilla Pascal or C. Steven Pemberton, CWI, Amsterdam; steven@mcvax.