News for hackers. Stuff that matters.
Re:What XOR is and why it's useful by wat10000 on Tuesday February 18, 2025 @04:30PM (#43095353)
C does have a logical XOR, it's the `!=` operator. Unlike other logical operators, it requires the arguments to be normalized to a single truth value. It plays nicely with C's convert-to-boolean operator `!!`.
Re:What XOR is and why it's useful by wslh on Tuesday February 18, 2025 @09:39PM (#43097943)
^ ?
Re:What XOR is and why it's useful by 201984 on Tuesday February 18, 2025 @10:05PM (#43098104)
That's bitwise, not logical.
Re:What XOR is and why it's useful by 8n4vidtmkvmk on Tuesday February 18, 2025 @10:09PM (#43098128)
That's bitwise xor
Re:What XOR is and why it's useful by Findecanor on Wednesday February 19, 2025 @02:57AM (#43099757)
I once failed a a test at a job interview because I hadn't realised that (even after having been programming for twenty years).
Re:What XOR is and why it's useful by gblargg on Wednesday February 19, 2025 @06:52AM (#43101097)
No need for the second !: !foo != !bar
Re:What XOR is and why it's useful by wat10000 on Wednesday February 19, 2025 @08:47AM (#43102089)
True, but you might confuse people if you use a nonstandard construct like this.