Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1a 12/4/83; site rlgvax.UUCP Path: utzoo!linus!decvax!harpo!seismo!rlgvax!guy From: guy@rlgvax.UUCP (Guy Harris) Newsgroups: net.unix-wizards,net.bugs.4bsd Subject: Re: Please use NULL instead of 0 whenever you have a pointer! Message-ID: <1546@rlgvax.UUCP> Date: Sat, 14-Jan-84 15:18:49 EST Article-I.D.: rlgvax.1546 Posted: Sat Jan 14 15:18:49 1984 Date-Received: Sun, 15-Jan-84 05:59:52 EST References: <210@basserva.UUCP> <151@ttds.UUCP> Organization: CCI Office Systems Group, Reston, VA Lines: 19 Actually, in NULL is defined as 0, which is really as it should be. So whether you use 0 or NULL makes no difference (unless somebody made the mistake of defining NULL as "(char *)0"); you still have to cast it explicitly. Then again, that's what "lint" is for; it's a good idea to run "lint" on any program which isn't a quick throw-away or very small and written by somebody you *know* won't make type errors - on the other hand, I don't know anybody like that, myself included. (If NULL were defined as "(char *)0", "lint" would get gastric distress whenever NULL were passed as a pointer argument to a routine which expected an "int *" or something like that. Furthermore, if you tried to assign "(char *)0" to an "int *" variable, PCC would justifiably complain about an illegal pointer combination. C doesn't have the notion of a generic "null pointer", it has a "null pointer to char" which is distinct from "null pointer to int" which is distinct from "null pointer to (struct proc)"....) Guy Harris {seismo,ihnp4,allegra}!rlgvax!guy