Newsgroups: comp.lang.c Path: utzoo!henry From: henry@utzoo.uucp (Henry Spencer) Subject: Re: calloc (actually NULL =?= 0) Message-ID: <1989Apr13.172541.2024@utzoo.uucp> Organization: U of Toronto Zoology References: <22842@shemp.CS.UCLA.EDU> <1428@auspex.auspex.com> <987@atanasoff.cs.iastate.edu> Date: Thu, 13 Apr 89 17:25:41 GMT In article <987@atanasoff.cs.iastate.edu> hascall@atanasoff.cs.iastate.edu (John Hascall) writes: >>>I always thought a pointer consisting of zero bits is NULL. > >>Nope. No such guarantee was ever made by any C language spec. > > What about the following taken from K&R, Appendix A, section 7.14, > "Assignment operator": > > However, it is guaranteed that assignment of the > constant 0 to a pointer will produce a null pointer... "Produce" a null pointer. And note that it says *constant*. An integer constant 0 in a pointer context is C's odd way of writing the null pointer as a constant. This is purely a *notation*; it does not necessarily have anything to do with the actual representation. On seeing this curious bit of notation, the compiler generates whatever bits are needed. -- Welcome to Mars! Your | Henry Spencer at U of Toronto Zoology passport and visa, comrade? | uunet!attcan!utzoo!henry henry@zoo.toronto.edu