#defining NULL as (-1) in stdio

Doug Gwyn gwyn at brl-smoke.ARPA
Fri Jun 24 01:56:06 AEST 1988


In article <4036 at pasteur.Berkeley.Edu> moore at ic.berkeley.edu (Peter X Moore) writes:
>[NULL] is simply a magic cookie defined in stdio.h and returned by some
>of the stdio functions to signal an error.

WRONG.  "NULL" has always been intended to represent a null pointer --
where do you think it got its name?  Functions that return pointers can
return either a valid pointer or a null pointer, so that NULL in fact is
often useful as the return value to indicate an unsuccessful operation.
But the more general meaning is simply "null pointer".



More information about the Comp.lang.c mailing list