Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!henry
From: henry@utzoo.UUCP (Henry Spencer)
Newsgroups: net.lang.c
Subject: Re: Must a NULL pointer be a 0 bit pattern?
Message-ID: <4483@utzoo.UUCP>
Date: Wed, 17-Oct-84 11:57:31 EDT
Article-I.D.: utzoo.4483
Posted: Wed Oct 17 11:57:31 1984
Date-Received: Wed, 17-Oct-84 11:57:31 EDT
References: <6542@mordor.UUCP> <5272@brl-tgr.ARPA> <196@rlgvax.UUCP>, <529@wjh12.UUCP>
Organization: U of Toronto Zoology
Lines: 26

> 	union {
> 		char *	p_member;
> 		double	f_member;
> 		char	c_member[COVERS_P_AND_F];
> 	} implicitly_initialized_to_zero;
> 
> It seems to me that K&R guarantees that, when the program begins
> execution, p_member, f_member and c_member are guaranteed to be
> zero simultaneously, and the only way to do it is to make them all a
> zero bit pattern.  I don't have my manual with me--can anyone try to
> poke holes in this?  It may be that the K&R wording isn't rigorous
> enough, and that my proof "falls to the ground".

I think your last conjecture is correct, i.e. K&R simply is not being
specific enough.  Note that a floating-point zero isn't necessarily
an all-zeros bit pattern either.  The K&R wording can be interpreted
in one of two ways:

1. Implicitly-initialized storage starts out as all-zeros bit patterns,
	which doesn't necessarily look like a 0 in all data types.

2. Implicitly-initialized storage looks like 0's, and the semantics of
	initializing unions simply aren't defined well enough.
-- 
				Henry Spencer @ U of Toronto Zoology
				{allegra,ihnp4,linus,decvax}!utzoo!henry