Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!uxc.cso.uiuc.edu!uxc.cso.uiuc.edu!m.cs.uiuc.edu!s.cs.uiuc.edu!carroll From: carroll@s.cs.uiuc.edu Newsgroups: comp.unix.wizards Subject: Re: Referencing NULL pointers Message-ID: <216100013@s.cs.uiuc.edu> Date: 17 Jul 89 15:17:00 GMT References: <20245@adm.BRL.MIL> Lines: 17 Nf-ID: #R:adm.BRL.MIL:20245:s.cs.uiuc.edu:216100013:000:887 Nf-From: s.cs.uiuc.edu!carroll Jul 17 10:17:00 1989 /* Written 3:44 pm Jul 16, 1989 by jbm@eos.UUCP in s.cs.uiuc.edu:comp.unix.wizards */ It has been pointed out that there should be no assumptions about what addresses are valid; is there any way to get a guaranteed INVALID address? /* End of text from s.cs.uiuc.edu:comp.unix.wizards */ What do you mean by "INVALID"? That it will cause a core dump when written to, just dereferenced, or is never a valid pointer value? For the first two, no, there isn't one. For the last, you should be able to use 0 (or better, NULL from stdio.h). According to K&R(1), the value 0 for a pointer is guaranteed not to point to a valid object. I find it difficult to believe that ANSI-C changed that. Alan M. Carroll "Oh goody, the Illudium Q-36 Explosive carroll@s.cs.uiuc.edu Space Modulator!" CS Grad / U of Ill @ Urbana ...{ucbvax,pur-ee,convex}!s.cs.uiuc.edu!carroll