Why does i|= j|= k|= (j+= i) - - (k+++k) - - (i =+j) == 11?

后端 未结 4 1893
挽巷
挽巷 2020-12-22 14:33

I came across this code in a project I have started working on. The original developer is no longer available, and I can\'t make any sense of it:



        
4条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-22 15:15

    Your program invokes undefined behavior in C. You are modifying i and j more than one time between two sequence points.

    In Java and JavaScript the behavior is well-defined, and you have to look at the precedence and associativity of the operators.

提交回复
热议问题