Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.csd.uwm.edu!gem.mps.ohio-state.edu!ginosko!uunet!bfmny0!tneff From: tneff@bfmny0.UUCP (Tom Neff) Newsgroups: comp.lang.c Subject: Re: Creating pointer with all bits 0 (was: Referencing NULL pointers) Message-ID: <14634@bfmny0.UUCP> Date: 6 Sep 89 13:21:21 GMT References: <1989Aug31.052756.18524@sq.sq.com> <2030@se-sd.NCR.COM> <1989Sep6.052228.17374@algor2.algorists.com> Reply-To: tneff@bfmny0.UU.NET (Tom Neff) Organization: ^ Lines: 26 I guess this 0 vs NULL thing will never get settled no matter how many times Doug and Chris explain it. So I'll carry the sandbucket for a turn. ;-) * Pointer and integer don't have to occupy the same storage or look alike, and even where they do a NULL pointer doesn't have to contain all zero bits. * Where a conforming program LOOKS like it's violating the above, by casting 0 to a pointer type to create NULL, the compiler is welcome to treat that instance of "0" *specially* so as to really create a NULL. It does NOT mean that the pointer's storage is temporarily treated as int storage and filled with the bit pattern an int 0 would get. * Other integer to pointer casts are not guaranteed to be portable. * Environments where constant pointers other than NULL are significant do occur, but the situations where you use them are non-portable. ANS conforming compilers will presumably offer non portable extensions to cover such things. In widespread environments like UNIX where this is an issue, it would be reasonable to defer to POSIX (e.g.) for guidance. In DOS land and such, just use what the vendor supplies. -- Annex Canada now! We need the room, \) Tom Neff and who's going to stop us. (\ tneff@bfmny0.UU.NET