Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84 SMI; site sun.uucp Path: utzoo!watmath!clyde!burl!ulysses!ucbvax!decvax!decwrl!sun!guy From: guy@sun.uucp (Guy Harris) Newsgroups: net.lang.c Subject: Re: if(p) Message-ID: <2847@sun.uucp> Date: Thu, 3-Oct-85 01:05:18 EDT Article-I.D.: sun.2847 Posted: Thu Oct 3 01:05:18 1985 Date-Received: Sat, 5-Oct-85 02:34:35 EDT References: <1671@brl-tgr.ARPA> <516@talcott.UUCP> <2245@ukma.UUCP> Organization: Sun Microsystems, Inc. Lines: 16 > So when you say if(p) you're asking if it has a VALID or INVALID value. > It's just that conveniently most machines have 0 as the INVALID value. If you had a machine on which the bit pattern stored in an invalid pointer was 0x12344321, the way to test whether a pointer is valid or not is if (p) /* or if (p != 0) or if (p != NULL) */ printf("valid\n"); else printf("invalid\n"); The fact that "0" is converted to the appropriate pattern for an invalid pointer (of the type in question) does not imply that those pointers have to have a bit pattern of all zeroes. Guy Harris