lkml.org 
[lkml]   [1999]   [May]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: 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]
\
 
 \ /
  Last update: 2005-03-22 13:51    [W:0.087 / U:1.696 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site