Path: utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!ukma!uflorida!haven!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn ) Newsgroups: comp.lang.c Subject: Re: pointers, tests, casts Message-ID: <9073@smoke.BRL.MIL> Date: 5 Dec 88 17:07:54 GMT References: <11130@dartvax.Dartmouth.EDU> <44100016@hcx3> <9038@smoke.BRL.MIL> <44803@yale-celray.yale.UUCP> Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB)) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 11 In article <44803@yale-celray.yale.UUCP> wald-david@CS.YALE.EDU (david wald) writes: >Isn't the latter generally preferable, given its possible use as a >parameter for a function with no prototype in scope? Further, isn't the >former dangerous in this case, given that there is no guarantee for NULL >and (int)0 to have the same representation? There's also no guarantee that (void *) and other pointer types have the same representation. You MUST cast NULL when using it as a function argument with no prototype in scope. (If it happens to work without a cast, it's an accident. Your program should not rely on accidents to work correctly.)