Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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 `!!`.


I once failed a a test at a job interview because I hadn't realised that (even after having been programming for twenty years).


No need for the second !: !foo != !bar


True, but you might confuse people if you use a nonstandard construct like this.


^ ?


That's bitwise xor


That's bitwise, not logical.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: