Path: utzoo!attcan!uunet!aplcen!uakari.primate.wisc.edu!zaphod.mps.ohio-state.edu!ncar!mephisto!mcnc!rti!dg-rtp!dg-rtp.dg.com!goudreau From: goudreau@dg-rtp.dg.com (Bob Goudreau) Newsgroups: comp.lang.c Subject: Re: Seven Original Sins of K&R (Long) Message-ID: <1990Sep26.163927.26084@dg-rtp.dg.com> Date: 26 Sep 90 16:39:27 GMT References: <12780@sdcc6.ucsd.edu> Sender: usenet@dg-rtp.dg.com (Usenet Administration) Reply-To: goudreau@dg-rtp.dg.com (Bob Goudreau) Organization: Data General Corporation, Research Triangle Park, NC Lines: 35 In article <12780@sdcc6.ucsd.edu>, mautner@odin.ucsd.edu (Craig Mautner) writes: > > The Second Original Sin was the failure to make "NULL" > a keyword. Beginning C programmers wonder why you have > to "#include " in a program that doesn't use > standard I/O. Some compilers don't even object when > you assign an integer constant to a pointer without a > typecast, especially when the constant happens to be > zero. Don't blame the compiler. The poor thing can't > tell the difference between a zero integer constant and > "NULL". Or better yet, how about a new operator named "nil", which takes a type name (sorry, pointer types only need apply) and which evaluates to the nil pointer of that type? For example, char * cp; .... if (cp == nil(char *)) .... Of course, it's easy enough to implement now as a macro, but think of all the comp.lang.c articles that could have been avoided by building it into the language and thus avoiding having the token "0" do double duty... ---------------------------------------------------------------------- Bob Goudreau +1 919 248 6231 Data General Corporation 62 Alexander Drive goudreau@dg-rtp.dg.com Research Triangle Park, NC 27709 ...!mcnc!rti!xyzzy!goudreau USA