For binomial operators such as the operator of the Quaternary operation and the assignment operator,
It's easy to imagine a scene where the order of combination (left to right, right to left) means something.
It's hard to imagine a scene where the sequence of monomial operators is meaningful.
When does it make sense?
For example, monomial minus is
-1-1
The merge order seems to make sense in the scene, but
In fact, the latter minus is the minus of the binomial operator, and
because it only follows the order of precedence (single-term minus > binomial operator subtraction)
The monomial negative bond order should not be relevant in this case.
Also, I am not sure when the order of increments and decrements is meaningful.
x++ "evaluates and adds one" and
I also thought that the difference of ++x is that it is evaluated after adding 1
According to the
C Language Introduction (ASCII SOFTWARE SCIENCE Language),
"The merge order is the order in which C evaluates operators with the same priority"
This is not the case in this case.
Isn't it meaningful when two or more monomial operators are superimposed?
inti=10;
printf("%d\n",!!i)<
i
is evaluated and 10
is obtained.Then !i
to 0
.Finally, 1
in !!i
.Is the pre-monomial operator only from the right and the post-monomial operator from the left so that it can flow naturally?
I will answer myself based on the link to Nekketsuuu's comment.
If you have any other comments, I would like to revise them, so please let me know if you have any comments.
For increments and decrements, for example,
++*y
Combination order is meaningful in cases such as (prefix ++ and * have the same priority)
Left-hand coupling
(++*)y
is synonymous with
In this case, an error occurs unless * allows ++ as an operand or there is a right-coupled operator named ++*.
On the other hand, if it's a right bond,
++(*y)
is synonymous with
In fact, * and ++ are right-coupled, so you will evaluate the pointer destination variable by increasing it.
In the case of a monomial operator, the operator has only one object on one side, so it has no choice but to join from that object side.For example, if you write *p
with the indirect operator *
, you want to join it to the left, but there is no operand on the left, so there is no way to join it.
© 2024 OneMinuteCode. All rights reserved.