calloc (actually NULL =?= 0)

Felix Lee flee at shire.cs.psu.edu
Thu Apr 13 23:58:19 AEST 1989


The answer is that 0 cast to a pointer type yields a null pointer.
And a null pointer cast to an integer yields 0.  A null pointer is not
necessarily a zero bit pattern.  Just as 0.0 is not necessarily a zero
bit pattern.

Actually, I can't see any particular reason for (int)0 to be a zero
bit pattern either (unless it's mandated by pANS).  Hmm.  I have to go
rethink using bit operations, so my code ports easily to Gray code and
negabinary computers... :-)
--
Felix Lee	flee at shire.cs.psu.edu	*!psuvax1!shire!flee



More information about the Comp.lang.c mailing list