how has C bitten you?

Henry Spencer henry at utzoo.UUCP
Sat Sep 7 02:32:41 AEST 1985


> Is it also possible to give a NULL-pointer to a procedure as a parameter,
> if for example the procedure would return several values, and we are not
> interested in all of them?
> 
> wait(0) works at least here (4.2BSD), but something like this does not:
> ...
> 	(void)read(fd, 0, n);

Passing NULL only works if the function is prepared for the possibility
and explicitly checks for it.  wait() does; read() does not.  See the
documentation.  By the way, that should be "wait( (int *)0 )", to make
sure the type is right; the Unix documentation is often sloppy about this
particular detail, since it originated on machines where the sloppiness
didn't cause any problems.
-- 
				Henry Spencer @ U of Toronto Zoology
				{allegra,ihnp4,linus,decvax}!utzoo!henry



More information about the Comp.lang.c mailing list