x=x+1 vs. x +=1

后端 未结 17 1308
独厮守ぢ
独厮守ぢ 2020-12-29 02:57

I\'m under the impression that these two commands result in the same end, namely incrementing X by 1 but that the latter is probably more efficient.

If this is not c

17条回答
  •  渐次进展
    2020-12-29 03:15

    In C++ it depends what datatype is x and how are operators defined. If x is an instance of some class you can get completely different results.

    Or maybe you should fix the question and specify that x is an integer or whatever.

提交回复
热议问题