Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!ames!oliveb!sun!gorodish!guy From: guy%gorodish@Sun.COM (Guy Harris) Newsgroups: comp.lang.c Subject: Re: Casting NULL? Message-ID: <12048@sun.uucp> Date: Sat, 24-Jan-87 04:26:53 EST Article-I.D.: sun.12048 Posted: Sat Jan 24 04:26:53 1987 Date-Received: Sat, 24-Jan-87 13:46:18 EST References: <3179@brl-adm.ARPA> Sender: news@sun.uucp Reply-To: guy@sun.UUCP (Guy Harris) Organization: Sun Microsystems, Mountain View Lines: 17 >I have a question about pointers: I just recently read >a C text where whenever NULL was passed as a parameter >it was casted to the proper type. All praise to the author of the text for that! >He claimed that this is required because pointers to different types of >objects may not be the same size. That isn't the half of it. NULL is *!*!NOT*!*!* a pointer, in most implementations of C, it's just 0. (There are good reasons for this.) There are plenty of implementations where 0 and "(char *)0" are not the same size. Furthermore, there is no guarantee whatsoever that an integral constant 0 and and a null pointer of some type have the same bit pattern.