Is there a NULL pointer to functions?

der Mouse mouse at thunder.mcrcim.mcgill.edu
Sun Jun 2 07:04:19 AEST 1991


In article <4429 at inews.intel.com>, bhoughto at pima.intel.com (Blair P. Houghton) writes:

[stuff about comparing pointer-to-function to NULL]

> [ANSI X3.159-1989, sec. 3.2.2.3, says]

> 	"An integral constant expression with the value 0, or such an
> 	 expression cast to type void *, is called a null pointer
> 	 constant.  If a null pointer constant is assigned to or
> 	 compared for equality to a pointer, the constant is converted
> 	 to a pointer of that type.  Such a pointer, called a null
> 	 pointer, is guaranteed to compare unequal to a pointer to any
> 	 object or function."

> This doesn't abrogate the necessity that comparisons involve
> compatible types, however, nor that bare constants take the type of
> the object to which they are assigned or compared.

But I believe it *does* require that comparing a function pointer to
(void *)0 convert the null pointer to the appropriate function pointer
type, which the compiler in the original posting was not doing.  (Or at
least was not being silent about.)

					der Mouse

			old: mcgill-vision!mouse
			new: mouse at larry.mcrcim.mcgill.edu



More information about the Comp.lang.c mailing list