Path: utzoo!attcan!uunet!snorkelwacker!paperboy!skeptic!lwa From: lwa@skeptic.osf.org (Larry Allen) Newsgroups: comp.unix.wizards Subject: Re: What machines core dump on deref of NULL? Message-ID: <10154@paperboy.OSF.ORG> Date: 29 Jun 90 13:32:28 GMT References: <412@minya.UUCP> <444@mtndew.UUCP> <31079@cup.portal.com> <13226@smoke.BRL.MIL> Sender: news@OSF.ORG Reply-To: lwa@skeptic.osf.org (Larry Allen) Organization: Open Software Foundation Lines: 22 Sorry, John, I have to disagree. On such a piece of hardware, a NULL pointer simply can't be represented as an all zero bit pattern. The representation of the NULL pointer has to guarantee that a NULL pointer will NEVER match a valid address -- if it does, then a comparison against NULL is not guaranteed to be unique. You have to get out of the mindset of expecting that NULL is equal to 0. As Doug Gwyn has so eloquently pointed out in the past, a NULL pointer is NOT a zero bit pattern, it's a distinguished language construct that's represented by the token "0" of type "pointer to ...". The language doesn't (and shouldn't) place any requirements on how NULL is represented, save that it must not be the same as any piece of valid storage that the program can access. So, you see, dereferencing a pointer whose bit representation is 0 may well be a valid thing to do, but dereferencing a NULL pointer is never valid. -Larry Allen Open Software Foundation