Re:C for All
by userbinator on Friday March 23, 2018 @11:25PM
(#16664653)
I suppose ^^ might work, although a little odd because by consistency it would otherwise be the "logical XOR", a mythical operator that doesn't actually make much sense.
[ Parent
| on HN ]
> a mythical operator that doesn't actually make much sense.
Hmm I'm pretty sure practically every programming languages have it. It usually looks like "!=" or "<>".
The even more obscure logical XNOR is usually denoted "==" or "="
Re:C for All
by kazagistar on Saturday March 24, 2018 @11:33AM
(#16667094)
Alas, this doesn't deal with the idea of truthyness as a proper logocal XOR would, so it is incorrect in many of the most popular languages, including C, where a value that is true is not always equal to another value that is true. This only works in the much more strongly typed languages, or when you force cast both sides to a boolean with something like !!
Yes! In C its full spelling is "!a != !b".
Not quite..
Re:C for All
by theOnliest on Saturday March 24, 2018 @08:26AM
(#16666274)
Perl has logical xor, which is occasionally useful. I usually reach for it when argument checking, where it makes sense to have either this param or that but not both.