News for hackers. Stuff that matters.
Re:Dennis Ritchie on the priorities of && || vs. == etc. (1982) by tsimionescu on Saturday January 06, 2024 @02:48AM (#38889403)
The important part that makes the parens in the second operation unnecessary is that addition is associative, not that it's commutative. And concatentation is also associative, so even if those were strings, the parens would still be unnecessary.

That is, (a+b)+c == a+(b+c).

Interestingly, C integer addition is not actually associative, since (1+INT_MAX) + (-1) is UB, but 1+(INT_MAX+(-1)) should in principle be defined as INT_MAX.

Re:Dennis Ritchie on the priorities of && || vs. == etc. (1982) by xigoi on Saturday January 06, 2024 @03:43PM (#38895251)
And floating-point addition is not associative in any language: