▲ | nyrikki 9 days ago | |
In C, that is really because Unary minus (negation) has precedence over binary operations.
https://en.cppreference.com/w/cpp/language/operator_arithmet...
The same doesn't apply to, !! Which is applied as iterated binary operations (IIRC)I am pretty sure the decriment operator came around well after that quirk was established. | ||
▲ | seanhunter 9 days ago | parent [-] | |
Peter van der Linden’s book “Expert C Programming” (which is awesome btw) says that one of them (Kernighan, Richie or maybe Ken Thompson I forget) realised early on that the c compiler had the wrong operator precedence for bit twiddling and unary and boolean operators but “at that stage we had a few thousand lines of C code and thought it would be too disruptive to change it” |