Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!elroy.jpl.nasa.gov!news.arc.nasa.gov!ads.com!potomac.ads.com!jtn From: jtn@potomac.ads.com (John T. Nelson) Newsgroups: comp.std.c Subject: Re: gcc and NULL function pointers. Message-ID: <1991Jun20.164003.12151@potomac.ads.com> Date: 20 Jun 91 16:40:03 GMT References: <1991Jun19.182420.12673@athena.mit.edu> Organization: Advanced Decision Systems, Arlington, VA Lines: 32 >peter@ficc.ferranti.com (Peter da Silva) writes: > <1991Jun19.182420.12673@athena.mit.edu> scs@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@mimsy.umd.edu INTERNET: jtn@potomac.ads.com =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=