calloc (actually NULL =?= 0)

John Hascall hascall at atanasoff.cs.iastate.edu
Thu Apr 13 06:42:39 AEST 1989


In article <1428 at auspex.auspex.com> guy at auspex.auspex.com (Guy Harris) writes:
>>According to Harbison + Steele's book, calloc returns a region of
>>memory with all bits set to zero. They also point out that pointers
 
>>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":

       [talking about assigning ints to/from pointers
       being "a bad thing"] ...
       However, it is guaranteed that assignment of the
       constant 0 to a pointer will produce a null pointer...


 John Hascall / ISU Comp Center



More information about the Comp.lang.c mailing list