Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!wuarchive!udel!princeton!notecnirp!nfs From: nfs@notecnirp.Princeton.EDU (Norbert Schlenker) Newsgroups: comp.os.minix Subject: Re: NULL Keywords: NULL 0 ANSI Message-ID: <21229@princeton.Princeton.EDU> Date: 13 Nov 89 03:05:08 GMT References: <4455@ast.cs.vu.nl> <1347@gould.doc.ic.ac.uk> Sender: news@princeton.Princeton.EDU Reply-To: nfs@notecnirp.UUCP (Norbert Schlenker) Organization: Dept. of Computer Science, Princeton University Lines: 21 In article <1347@gould.doc.ic.ac.uk> dds@cc.ic.ac.uk (Diomidis Spinellis) writes: > appeals to authority omitted >... >3. Will defining NULL as ((void *)0) enable some WRONG programs to > successfuly run on some architectures and C implementations? [yes] >... >Yes. In some architectures and some C implementations WRONG programs >will work. Here is an example for this: >... > example of broken code that works correctly if NULL is ((void *) 0) omitted The argument is specious. It is not hard to come up with broken code, similar to that of the article, which works when NULL is defined as 0 and not when it is defined as ((void *) 0). All things considered, I think it will be more portable to define NULL as a simple 0. I don't think that appeals to Harbison and Steele are germane, and the draft ANSI standard leaves it (purposely) vague. It's just simpler to use 0. Norbert