Path: utzoo!utgpu!watserv1!watmath!att!drutx!mab From: mab@drutx.ATT.COM (Alan Bland) Newsgroups: comp.sys.amiga.tech Subject: Re: JRComm, VLT, Handshake Message-ID: <6463@drutx.ATT.COM> Date: 29 Oct 90 04:08:02 GMT References: <1990Oct11.235942.2141@caen.engin.umich.edu> <9811@uhccux.uhcc.Hawaii.Edu> <15328@cbmvax.commodore.com> <458@faatcrl.UUCP> <15418@cbmvax.commodore.com> <466@faatcrl.UUCP> Reply-To: mab@drutx.ATT.COM (Alan Bland) Distribution: na Organization: AT&T, Denver, CO Lines: 25 In article <466@faatcrl.UUCP> jprad@faatcrl.UUCP (Jack Radigan) writes: > But, my question is the NULL pointer itself, if NULL is a valid constant, >then the location NULL should contain nothing either, right? > > If I somehow missed something so embarrassingly basic, how come I can't >find it in K&R, which is supposed to be the last word in 'C'? I don't have K&R handy, and I can't find any mention of the subject in my other available references, but plain old experience tells me that it is incorrect to dereference a NULL pointer. Regardless of whether you rely on what happens to be stored at location zero, simply trying to read what's there will cause problems on some machine architectures (some UNIX boxes will "core dump" a process that merely glances in the general direction of location zero). It's most definitely non-portable. I'm sure I'm not the only one, but attempting to dereference a NULL pointer is one of those basic no-no's that I thought was obvious to everyone. Kind of like trying to read past the end of an array; C lets you do it, and sometimes it works, but you better not rely on it to always behave the same way. -- -- Alan Bland -- att!drutx!mab == mab@drutx.ATT.COM -- AT&T Bell Laboratories, Denver CO -- (303)538-3510