From: utzoo!decvax!harpo!seismo!hao!csu-cs!silver
Newsgroups: net.unix-wizards
Title: Questions about nil-pointer dereferences (the "plague")
Article-I.D.: csu-cs.1979
Posted: Fri Jan 14 12:37:54 1983
Received: Mon Jan 17 02:59:02 1983

We are bringing up System III on a machine that traps attempts to
indirect through zero pointers.  (Writing code that does this is
at very least a poor practice and somewhat antisocial...)  Anyway,
we run into a lot of these in imported code.  I understand that
most (all?) DEC hardware supports "int  *p = 0; i = *p;" by mapping
memory to zero so *p returns zero.  Questions:

1: Is there any GOOD reason for writing code that exercises this
   feature?

2: What if I do "int *a = 0, *b = 0; *b = 10; i = *a;"?  What is
   the value of i?  Does this mean that assigning indirect through
   a nil pointer is deadly to the rest of your nil pointer derefs?

Any other comments?  Please respond to the net if short and and of
general interest, else mail me.  Thanks!

Alan Silverstein (harpo!seismo!hao!csu-cs!silver)
HP Fort Collins Colorado