Path: utzoo!attcan!uunet!know!zaphod.mps.ohio-state.edu!tut.cis.ohio-state.edu!ucbvax!agate!e260-2d!labb-2ae From: labb-2ae@e260-2d.berkeley.edu (Joe C.) Newsgroups: comp.sys.amiga.tech Subject: Re: JRComm, VLT, Handshake Message-ID: <1990Oct28.190450.19932@agate.berkeley.edu> Date: 28 Oct 90 19:04:50 GMT References: <458@faatcrl.UUCP> <15418@cbmvax.commodore.com> <466@faatcrl.UUCP> Sender: usenet@agate.berkeley.edu (USENET Administrator) Distribution: na Organization: University of California, Berkeley Lines: 29 In article <466@faatcrl.UUCP> jprad@faatcrl.UUCP (Jack Radigan) writes: >andy@cbmvax.commodore.com (Andy Finkel) writes: > >>If your program breaks when location 0 is non NULL this means >>you have an unitialized pointer somewhere in your program, and >>are using memory you did not allocate (ie location 0) > > Uh, according to K&R, NULL is a valid assignment for a pointer, so >how is it unitialized? The pointer is initialized to NULL. That means it is pointing to NOWHERE. You have to look at it from a data abstraction point of view. You're not supposed to *dereference* a NULL pointer, because again, it is pointing to NOWHERE. > But, my question is the NULL pointer itself, if NULL is a valid constant, >then the location NULL should contain nothing either, right? Again, your supposed to look at the data abstraction point of view. To say what "location NULL" contains is meaningless. Your pointer is NULL; don't say it is pointing to NULL, rather it *is* NULL. Anyway, you're not supposed to dereference a NULL, so it doesn't matter that NULL is 0, and location 0 might contain anything. Dereferencing a NULL is like asking: where is nothing pointing to? -jc --- labb-2ae@web.berkeley.edu