thanks for "down" answers

Dave Jones djones at megatest.UUCP
Thu Dec 15 06:46:17 AEST 1988


>From article <1886 at loral.UUCP>, by jlh at loral.UUCP (Physically Phffft):

...

> In all his examples he used wait ( (char *) 0).
> I pointed out to him that wait wanted an address in which to 
> stuff a result, and using 0 was probably not a good idea.  His 
> reply was 'thats how it is in my manual', after a few minutes
> of discussion it got upgraded to 'I tried it on my system and it 
> works'. 

Both perfectly valid and correct responces.

>From the manual:

     #include <sys/wait.h>

     pid = wait(status)
     int pid;
     union wait *status;

     pid = wait(0)
     int pid;

[Your instructor correctly casts the 0 to a pointer-type, which
the manual omits.]

If you want the status, you pass a non-null pointer and wait
knows what to do.  If you don't want the status, you pass a
null pointer, and wait knows what *not* to do.

To paraphrase Samuel L. Clemmons, I think that you will discover
in couple of years that your instructors have learned quite a bit
in the interim. :-)



More information about the Comp.lang.c mailing list