4 ms·
One of my favorite XOR stories is from Bryan Cantrill (of Oxide, Joyent, and Sun) in this presentation [0] and this video [1]. To avoid clicking a link: When h
by jjice 2y ago
One of my favorite XOR stories is from Bryan Cantrill (of Oxide, Joyent, and Sun) in this presentation [0] and this video [1].
To avoid clicking a link: When he was at Sun, he was chatting with a coworker (Roger Faulkner) about the lack of logical XOR in C. Faulkner said it was because you couldn't short circuit it, and Brian thought that was wild. Then Roger emailed Dennis Ritchie to ask and he confirmed it was what Faulkner had said.
That stories gets me every time! First of all, it's very funny and well delivered by Cantrill, but it's also just so incredible that they could ask the man himself.
[0] https://speakerdeck.com/bcantrill/oral-tradition-in-software-engineering-passing-the-craft-across-generations?slide=17 https://speakerdeck.com/bcantrill/oral-tradition-in-software...
[1] https://www.youtube.com/watch?v=4PaWFYm0kEw https://www.youtube.com/watch?v=4PaWFYm0kEw
- wat10000 2y agoC 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 `!!`.
- wslh 2y ago^ ?
- 201984 2y agoThat's bitwise, not logical.
- 8n4vidtmkvmk 2y agoThat's bitwise xor
- Findecanor 2y agoI once failed a a test at a job interview because I hadn't realised that (even after having been programming for twenty years).
- gblargg 2y agoNo need for the second !: !foo != !bar
- wat10000 2y agoTrue, but you might confuse people if you use a nonstandard construct like this.
- SteveDavis88 2y ago"...was chatting with a coworker about the lack of logical XOR in C" C has had the bitwise operator XOR '^' for over 40 years. https://www.geeksforgeeks.org/bitwise-operators-in-c-cpp/ https://www.geeksforgeeks.org/bitwise-operators-in-c-cpp/
- snvsn 2y agoTopic starts at 37:18
- kjs3 2y agoDMR was remarkably kind, helpful and accessible. As an undergrad in the mid 80s I read about 'the first' port of Unix (v6) to something other than a PDP-11, the Interdata 8/32. On a whim, I sent an email to dmr@research.att.com (might have even been back as far as research!dmr or dmr@alice.UUCP) asking if there was more info about the architecture as 1) no google and 2) nothing in the uni library. A couple of days later he responded and asked for my (physical) address. A few weeks later, a copy of the instruction set summary manual showed up in my (physical) mailbox. It's IBM 360-ish. Still have it.
- penguin_booze 2y ago> Faulkner said it was because you couldn't short circuit it I don't get it. Why is that an impediment to adding an operator? Can some one elaborate?
- gblargg 2y agoThere wouldn't be any advantage to adding a boolean exclusive or operator, unlike with || and &&.