Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!rutgers!ucla-cs!heather From: heather@SEAS.UCLA.EDU Newsgroups: comp.lang.c Subject: Re: use of NULL Keywords: NULL zero 0 C Microsoft Message-ID: <20928@shemp.CS.UCLA.EDU> Date: 23 Feb 89 17:29:06 GMT References: <1167@unisec.usi.com. <5312@turnkey.TCC.COM. <9582@smoke.BRL.MIL. <399@twwells.uucp: <973@optilink.UUCP> <9684@smoke.BRL.MIL> Sender: news@CS.UCLA.EDU Reply-To: heather@SEAS.UCLA.EDU (Heather Burris) Organization: UCLA School Of Engineering & Applied Science Lines: 20 In article <9684@smoke.BRL.MIL> gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) writes: >In article <973@optilink.UUCP> cramer@optilink.UUCP (Clayton Cramer) writes: >>Never pass bare 0 as a pointer argument -- but use the stdio.h >>definition of NULL, and the segmented architecture will NOT screw >>you. > >Wrong. Use of uncast NULL as an argument to a function is never correct >usage; although you can get away with it sometimes, it only "works" by >accident and may quit working suddenly if the implementation changes. >It is definitely not portable. Always cast 0 or NULL to the correct >pointer type when used as a function argument. Excuse me for a probably naive question that I've had since following the discussion of passing NULL to functions: Why doesn't the C standard treat NULL or 0 (a static/constant NULL or 0, i.e. indicated at compile time) passed to a function that has a pointer value in the function prototype as a special case and do the cast implicitly? Heather Burris, UCLA