gcc and NULL function pointers.

Steve Emmerson steve at groucho.ucar.edu
Tue Jun 11 12:07:34 AEST 1991


In <1991Jun10.081924.26439 at kithrup.COM> sef at kithrup.COM (Sean Eric Fagan) 
writes:

>ANSI does not require a prototype for non-variardic functions (as far as I
>can tell).  As a result, for a certain class of popular machines, under
>certain compiler options, defining NULL as 0 will be incorrect, while
>'(void*)0' is correct.

>And the program that would core-dump on this would be perfectly correct,
>according to ANSI.  The header file would, therefore, be wrong.

No.  Since the program didn't cast the macro NULL into the appropriate
type, it's relying on implementation-defined (or is it undefined?) 
behavior; hence, the program isn't strictly conforming ("correct" in
your terminology).

Steve Emmerson        steve at unidata.ucar.edu        ...!ncar!unidata!steve



More information about the Comp.std.c mailing list