Messages in this thread | | | From | Steve VanDevender <> | Date | Wed, 5 May 1999 11:17:44 -0700 (PDT) | Subject | Re: 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/
| |