4 ms·
most of this article is covered in the Wikipedia page: https://en.wikipedia.org/wiki/Relational_operator#Confusion_with_assignment_operators https://en.wikiped
by kolpa 9y ago
most of this article is covered in the Wikipedia page:
https://en.wikipedia.org/wiki/Relational_operator#Confusion_with_assignment_operators https://en.wikipedia.org/wiki/Relational_operator#Confusion_...
but Wikipedia says:
"The reason for all this being unknown. [footnote] Although Dennis Ritchie has suggested that this may have had to do with "economy of typing" as updates of variables may be more frequent than comparisons in certain types of programs"
while the OP says:
"As Thompson put it:
Since assignment is about twice as frequent as equality testing in typical programs, it’s appropriate that the operator be half as long."
Thompson and Ritchie designed C together.
- timbit42 9y agoEconomy of typing definitely shouldn't be the #1 concern when designing a language. Look at APL.