Path: utzoo!attcan!utgpu!watmath!att!tut.cis.ohio-state.edu!gem.mps.ohio-state.edu!apple!ames!haven!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.lang.c Subject: Re: Abandon NULL for (0) Message-ID: <11127@smoke.BRL.MIL> Date: 21 Sep 89 21:06:56 GMT References: <6502@ux.cs.man.ac.uk> <14718@bfmny0.UU.NET> Reply-To: gwyn@brl.arpa (Doug Gwyn) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 16 In article <14718@bfmny0.UU.NET> tneff@bfmny0.UU.NET (Tom Neff) writes: >However (0) is not explicitly cast to a pointer type, as NULL may be >presumed to be when appropriate. No, it may NOT be so presumed. >For instance if I refer to, but do not declare or define, an external >routine that accepts a single pointer as its argument, by saying >myproc((0)), the compiler will Miranda it into a regular int, rather >that ((void *) 0), which might have a different size and representation. And also a different representation from the (struct foo *) that was expected. Passing NULL to a function (assuming no prototype in scope) without casting it to the correct pointer type is a BUG.