calloc (actually NULL =?= 0)
Henry Spencer
henry at utzoo.uucp
Fri Apr 14 03:25:41 AEST 1989
In article <987 at atanasoff.cs.iastate.edu> hascall at 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 at zoo.toronto.edu
More information about the Comp.lang.c
mailing list