Incrementing: x++ vs x += 1

后端 未结 5 1913
囚心锁ツ
囚心锁ツ 2020-11-30 14:56

I\'ve read that many developers use x += 1 instead of x++ for clarity. I understand that x++ can be ambiguous for new developers and that x += 1 is always more clear, but i

5条回答
  •  一整个雨季
    2020-11-30 15:30

    Any decent compiler should be able to recognize that the two are the same so in the end there should be no performance difference between them.

    If you want to convince yourself just do a benchmark..

提交回复
热议问题