Is there a NULL pointer to functions?

Doug Gwyn gwyn at smoke.brl.mil
Thu May 30 13:05:02 AEST 1991


In article <632 at gca.UUCP> hinton at gca.UUCP (Edward Hinton) writes:
>However, I recall a system where 0 WAS a
>valid address (small model on an 8086 based virtual memory system)
>and NULL was defined to be -1.

While an implementation is allowed to make a construct like "((void*)-1)"
act like a null pointer, it is also required (by the standard) to treat
a null pointer constant written by the programmer as "0" (in certain
contexts) or "((void*)0)" as a valid way of denoting a null pointer.
Of course that does not mean that the implementation must internally use
address value 0 to represent a null pointer.  This, while ANY conforming
implementation can define NULL in the standard headers as simply "0",
this has nothing to do with address values.

This topic is covered in the FAQ list, q.v..



More information about the Comp.lang.c mailing list