gcc and NULL function pointers.

Peter da Silva peter at ficc.ferranti.com
Thu Jun 27 23:53:16 AEST 1991


In article <1991Jun26.053508.3634 at ringer.cs.utsa.edu> djimenez at ringer.cs.utsa.edu (Daniel Jimenez) writes:
> I thought 0 in a context where a pointer is expected (e.g., int *p; p = 0;)
> wasn't the integer 0, rather whatever that machine's representation of
> a null pointer is.

True, but there is a lot of broken but useful and important code floating
around the net that uses NULL in contexts where a pointer is needed but an
integer is expected. My claim is that it is in a compiler vendor's interest
to, whenever possible, define NULL such that such code continues to work.

It may not be possible. The value you need to use (either a void cast 0 or
just plain 0) is system dependent. There are lots of problems. But sometimes
it's possible, and when it is that's what the vendor should provide.

At least until the VAXisms are all fixed (one of these decades, maybe?)...
-- 
Peter da Silva; Ferranti International Controls Corporation; +1 713 274 5180;
Sugar Land, TX  77487-5012;         `-_-' "Have you hugged your wolf, today?"



More information about the Comp.std.c mailing list