gcc and NULL function pointers.

Blair P. Houghton bhoughto at hopi.intel.com
Fri Jun 21 15:46:35 AEST 1991


In article <SR0CXCH at xds13.ferranti.com> peter at ficc.ferranti.com (Peter da Silva) writes:
>I'm not responsible for that code. I know it's wrong. It is, however,
>something that I have to fix over and over and over again because one
>of your co-workers at intel decided to use a bondage-and-discipline
>definition of NULL in <stdio.h>. Technically correct, but practically
>a problem.

Do a global search-and-replace on the files, especially
if you ever expect to redistribute the code.  That's why
standard headers were invented, to be standard.  By
mucking about in yours, you engender bad design in
locally-produced software.

>I have better things to do with my time than fixing all the broken
>software in comp.sources.

There are about eight ways to attack this obvious piece of
bait, none of which I'm about to bother with.

>If I can get it working by futzing around
>in a defs.h file instead of groveling through the source to elm (a
>particularly poorly written example), I will.

Grovelling? All you need is

    sed 's/\([^_A-Za-z]\)NULL\([^_A-Za-z]\)/\1(void *)NULL\2/g'

>And: on an intel 80x86 (x<3) the best definition for NULL is (void *)0.

I wouldn't know.  I've never owned one. (But I bet
Barry Margolin never owned a Connection Machine,
either... :-)).  I would guess, however, that
the "best" definition is still `0'.

				--Blair
				  "It's what I'd use
				   on my personal Delta..."



More information about the Comp.std.c mailing list