Y
Hacker News
new
|
ask
|
show
|
jobs
by
sold
4137 days ago
What is the difference between x ?: y and x || y?
1 comments
smorrow
4137 days ago
|| gives 1 or 0 only?
link
sold
4137 days ago
I see, thanks.
link
smorrow
4137 days ago
"The C Companion" gives logical identities like
(A && B) || (A && !B) == A,
but what he means by A on the RHS, I think, is that you must take into account the fact that A_LHS might be zero. You can't really write this identity and give a constant on the right, so he wrote the next best thing.
Well, the real next best thing would be !(!A).
link