Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uflorida!haven!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.lang.c Subject: Re: Null revisited (briefly) Message-ID: <15820@mimsy.UUCP> Date: 6 Feb 89 04:13:09 GMT References: <13068@steinmetz.ge.com> <7630@chinet.chi.il.us> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 27 In article <7630@chinet.chi.il.us> les@chinet.chi.il.us (Leslie Mikesell) writes: >Does the (IMHO) incorrect cast of NULL to (char *) in some compilers >stdio.h hurt anything in a correctly written program? That (not just opinion) incorrect definition of NULL does indeed hurt. For instance, given the (correct) C code: #include int *ip = NULL; the compiler should at least warn about the improper assignment of (char *)0 to a variable of type (int *). A compiler with such a definition is likely to warn about or refuse to compile a large number of correct programs. Once again, the *ONLY* correct definitions of NULL are #define NULL 0 #define NULL 0L #define NULL ((void *)0) and possibly other constant expressions that evaluate to 0, 0L, or (void *)0 anyway. (char *)0 is *not* a proper untyped nil pointer. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris