Must a NULL pointer be a 0 bit pattern?

Henry Spencer henry at utzoo.UUCP
Fri Oct 19 02:21:14 AEST 1984


The ANSI C committee apparently has talked about the problem of the semantics
of default initialization to "zero".  I am told that the latest draft, about
to be released, says that the default initialization of static data acts as
if everything had been assigned the integer constant 0.  So pointers really
do get initialized to NULL and floating-point numbers to 0.0, regardless of
the actual bit-level representations.  And the rule for initialization of
unions resolves the original example that started this discussion.

It is agreed that the semantics of calloc() would be tricky on a machine
with non-000 representations of 0.0 or NULL, but there's no simple fix.
-- 
				Henry Spencer @ U of Toronto Zoology
				{allegra,ihnp4,linus,decvax}!utzoo!henry



More information about the Comp.lang.c mailing list