Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!elroy.jpl.nasa.gov!decwrl!deccrl!news.crl.dec.com!nntpd.lkg.dec.com!tkou02.enet.dec.com!jit533!diamond From: diamond@jit533.swstokyo.dec.com (Norman Diamond) Newsgroups: comp.std.c Subject: Re: gcc and NULL function pointers. Message-ID: <1991Jun21.033508.20151@tkou02.enet.dec.com> Date: 21 Jun 91 03:35:08 GMT References: <1991Jun19.182420.12673@athena.mit.edu> <9752@cognos.UUCP> Sender: usenet@tkou02.enet.dec.com (USENET News System) Reply-To: diamond@jit533.enet@tkou02.enet.dec.com (Norman Diamond) Organization: Digital Equipment Corporation Japan , Tokyo Lines: 27 In article <9752@cognos.UUCP> jimp@cognos.UUCP (Jim Patterson) writes: >Which is why there should be a standard definition. It avoids suprises >when porting to new environments. Correct coding avoids most surprises. If a correctly written program gets a surprise, ask the compiler vendor for a refund. (DISCLAIMER: This is personal opinion; my emplyer did not write this.) >Except for the substantial prior art for #define NULL (0), I think >(void*)0 is ALWAYS the best definition. >Of course, prior art is an important consideration, so I can't fault >the X3J11 group for leaving the definition somewhat ill-defined, but >if it were designed again from scratch I think the argument for >#define NULL (0) would be pretty weak. If C were designed again from scratch, it might have (void*) from scratch. Remember, a lot of null pointers were coded when C didn't have (void*)? Also, if C were designed again from scratch, NULL might be a reserved word, built into the language like in every other language that has pointers, instead of being #defined in terms of anything. Also, if C were designed again from scratch, it wouldn't be C. Kernighan and Ritchie would probably be willing to apply lessons of the 70's. -- Norman Diamond diamond@tkov50.enet.dec.com If this were the company's opinion, I wouldn't be allowed to post it. Permission is granted to feel this signature, but not to look at it.