Newsgroups: comp.std.c Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sdd.hp.com!apollo!r_miller From: r_miller@apollo.hp.com (Roger Miller) Subject: Re: gcc and NULL function pointers. Lines: 12 Message-ID: <1991Jun24.145434.4872@apollo.hp.com> Originator: r_miller@ike Sender: netnews@apollo.hp.com (USENET posting account) Nntp-Posting-Host: ike.ch.apollo.hp.com Organization: Hewlett-Packard Company, Apollo Division - Chelmsford, MA Date: Mon, 24 Jun 1991 14:54:34 GMT > The issue is that #defining NULL as ((void*)0) does NOT detect such > misuse, nor does it adequately compensate for it in all cases. Another reason you might prefer plain 0 to (void*)0 is that C++ does not allow implicit casts from void* to other pointer types. So if NULL is defined as (void*)0 you can't write "int *p = NULL". This is of course irrelvant in a pure C or pure C++ environment, but C++ programmers often want to share C header files, and I have seen this lead to #ifdef NULL #undef NULL #define NULL my-way battles in the source code.