Is there a NULL pointer to functions?

bxpfac at umiami.ir.miami.edu bxpfac at umiami.ir.miami.edu
Fri May 24 23:09:32 AEST 1991


I am not sure if this go posted the first time. Second try!

As the subject heading says, is there a NULL pointer to functions?
The program shown below when compiled with gcc generated 
the following message:

In function foo:
warning: ANSI C forbids comparison of `void *' with function pointer

/*-- Program --*/

#define NULL ((void *) 0)

void  foo (void (*fun) (void))
{
      if (fun != NULL)            /* Line with the warning. */
           fun ();   
}

Thanks for any suggestions to fix this.

Bimal / devebw9f at miavax.ir.miami.edu



More information about the Comp.lang.c mailing list