Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!caen!spool.mu.edu!uunet!indetech!cirrus!dhesi From: dhesi@cirrus.com (Rahul Dhesi) Newsgroups: comp.std.c Subject: Re: gcc and NULL function pointers. Message-ID: <1991Jun27.190107.627@cirrus.com> Date: 27 Jun 91 19:01:07 GMT References: <25572@well.sf.ca.us> <1146.Jun2221.20.2291@kramden.acf.nyu.edu> <16506@smoke.brl.mil> <17605.Jun2607.39.3591@kramden.acf.nyu.edu> Sender: news@cirrus.com Organization: Cirrus Logic Inc. Lines: 28 In <17605.Jun2607.39.3591@kramden.acf.nyu.edu> brnstnd@kramden.acf.nyu.edu (Dan Bernstein) writes: >'Scuse me for thinking about backwards compatibility in a standards >group. Good point! Let's keep this in mind. >By the way, I'm curious: Why is ((char *)0) ``simply wrong''? It's wrong for the same reason that ((void *) 0) is wrong. K&R said that NULL is defined to be 0. Therefore existing code that (unwisely) uses NULL to stand for a zero in a non-pointer context may break using either ((void *) 0) or ((char *) 0). However, ((void *) 0) is blessed by ANSI and ((char *) 0) is not. Therefore we may summarize: ((void *) 0) is ANSI-conformant but wrong. ((char *) 0) is not ANSI-conformant and wrong. And the bottom line: All definitions of NULL other than 0 are wrong, no matter how much or how little ANSI-conformant they may be. -- Rahul Dhesi UUCP: oliveb!cirrusl!dhesi