Is there a NULL pointer to functions?

bxpfac at umiami.ir.miami.edu bxpfac at umiami.ir.miami.edu
Wed May 22 02:56:39 AEST 1991


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