3 ms·
>Of course, it would be better if C-family languages didn’t use ^ for XOR in the first place. I think at the time they were created there simply wasn't an ambi
by simias 7y ago
>Of course, it would be better if C-family languages didn’t use ^ for XOR in the first place.
I think at the time they were created there simply wasn't an ambiguity in anybody's mind. POW is a relatively complex operation, I don't think anybody expected it as a builtin operator (much like SQRT and friends). Arguably so is DIV but I suppose that's too convenient not to have.
XOR on the other hand is something you really want to be a builtin operator in a low level, bit-twiddling language like C, so getting a dedicated operator makes sense. I'm not sure if an other sigil would've made more sense, after all ASCII lacks ⊕.
- dehrmann 7y ago> I think at the time they were created there simply wasn't an ambiguity in anybody's mind. And why would anyone in their right mind do 23 and not 1<<3? At least among the crowd who knows pow is expensive and what xor is.
- beezle 7y agoAlgol 68 and Fortran both had . In fact, COBOL 60 even supported so not sure why anyone would not expect it as builtin for C.