Messages in this thread | | | Date | Wed, 5 May 1999 21:46:00 +0200 | From | Kurt Garloff <> | Subject | Re: fork() Problem? |
| |
On Wed, May 05, 1999 at 09:52:23AM -0400, Richard B. Johnson wrote:
> > if (pid = fork()) > ^^^^________ logical test of an assignment? This will always > be true! > if((pid = fork()) != 0) or > if((pid = fork())) > You need to make the assignment first, then > test for non-zero.
SORRY? I can't let this uncorrected!
Why do you think it's legal to use smth like a = b = c; ???
Because b = c return the value assigned to b.
if (pid = fork()) do_smth;
is identical to if ((pid = fork()) != 0) do_smth;
-- Kurt Garloff <garloff@suse.de> SuSE GmbH, Nürnberg, FRG Linux kernel development; SCSI driver: DC390 (tmscsim/AM53C974) [unhandled content-type:application/pgp-signature] | |