gcc and NULL function pointers.

John T. Nelson jtn at potomac.ads.com
Fri Jun 21 02:40:03 AEST 1991


>peter at ficc.ferranti.com (Peter da Silva) writes:
> <1991Jun19.182420.12673 at athena.mit.edu> scs at adam.mit.edu writes:
>> I share Lars's disgust.
>
>Why?
>
>The "best" definition for "NULL" is entirely compiler/hardware dependent.
>*Most* of the time 0 is unequivocally correct. There are, however, computers
>and compilers for which ((void *)0) is more useful. No more "correct", from
>a standpoint of satisfying the ANSI standard, but more practical for people
>who want to port programs to that platform.
>
>And that's the point of *having* a standard for the language, after all.


I believe that there is some sort of caveat to using "0" with variable
argument lists.  Perhaps this is Lar's problem with the use of "0."
Remember that the example given was a call to execl which takes
variable arguments until terminated with null.

I have to agree with Peter Silva though.  The use of "0" or a symbol
called NULL which is defined to be "0" should be identical.  The
compiler will generate the same null pointer.  NULL defined as (void
*)0 should also work although it isn't necessary.



=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
SPOKEN:        John T. Nelson
ORGANIZATION:  Advanced Decision Systems   PHONE:      (703) 243-1611
UUCP:          kzin!speaker at mimsy.umd.edu  INTERNET:   jtn at potomac.ads.com
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=



More information about the Comp.std.c mailing list