Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!uakari.primate.wisc.edu!aplcen!unmvax!pprg.unm.edu!topgun.dspo.gov!lanl!cmcl2!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.lang.c Subject: Re: More NULL questions Message-ID: <11229@smoke.BRL.MIL> Date: 6 Oct 89 19:02:30 GMT References: <5950001@hpldola.HP.COM> Reply-To: gwyn@brl.arpa (Doug Gwyn) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 22 In article <5950001@hpldola.HP.COM> jg@hpldola.HP.COM (Joe Gilray) writes: >1) what is the danger with using > if (ptr != NULL) ... > as apposed to > if (ptr != (struct thing *)NULL) ... There is no danger, assuming the C implementation is correct. >2) Is there danger using > my_func(a, NULL, b); > as apposed to > my_func(a, (struct thing *)NULL, b); > when > a) you are using function prototypes? The only danger is that someone may port your code to a "classic C" environment and miss making the necessary edit. > b) you are NOT using function prototypes (like me)? Yes, it is erroneous to feed NULL to a function where a pointer argument is expected.