lkml.org 
[lkml]   [1999]   [May]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: fork() Problem?
Richard B. Johnson writes:
> > if (pid = fork())
> ^^^^________ logical test of an assignment? This will always
> be true!

No. An assignment expression has the value of the value
assigned. This allows expressions like a = b = c ('=' is
right-associative). It will be true if the assigned value is
true (nonzero), and false if the assigned value is false (zero).

However, it is generally more clear and less error prone to make
such tests explicit (i.e. (a = b) != 0).

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:51    [W:0.392 / U:0.436 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site