Path: utzoo!attcan!ncrcan!hcr!john From: john@hcr.uucp (John R. MacMillan) Newsgroups: comp.lang.c Subject: Re: references to dereferenced null pointers Message-ID: <1990Mar15.184903.3397@hcr.uucp> Date: 15 Mar 90 18:49:03 GMT References: <51083@microsoft.UUCP> <25EB8EE8.8462@paris.ics.uci.edu> <1990Mar12.175613.12082@utzoo.uucp> <1623@argus.UUCP> <1990Mar14.164539.23685@utzoo.uucp> <16179@haddock.ima.isc.com> Reply-To: john@troch.UUCP (John R. MacMillan) Organization: HCR Corporation, Toronto Lines: 18 Karl Heuer writes: |>There is absolutely nothing wrong with having a pointer representation in |>which the bit pattern for a null pointer is not all zeros... except that |>there are a lot of old, badly-written programs which will break. Thus my |>earlier comment that it is valid but unwise. | |Note that "p = 0", "p == 0", "!p", "char *f() { return 0; }" are *not* |examples of such badly-written code; they may be bad style, but the compiler |is required to generate correct code involving a true null pointer. The only |"dangerous" context (other than hacking with unions and such) is when a null |pointer constant is being passed as an argument to a function. ``Zeroing out'' pointers with memset, bzero, or calloc is another all-too-common problem. -- John R. MacMillan | "All the best freaks are here; please stop staring HCR Corporation | at me." {utzoo,utcsri}!hcr!john | -- Marillion