Why are shifts a lower priority than addition and subtraction in C?

I sometimes find this uncomfortable when I do bit manipulations (although I don't remember to recall any specific examples right now). I also find this conceptually confusing, since shifts are basically multiplication and division by powers of two.

I see that it can be convenient in C ++ when using <to send output to a stream, but of course, it is impossible to explain how the order was originally fixed in C.

+4
source share
1 answer

Because of this, the authors of C. decided

Use parentheses to avoid confusion.

+5
source

Source: https://habr.com/ru/post/1397528/


All Articles