Understanding more about i++ and i=i+1

后端 未结 4 802
借酒劲吻你
借酒劲吻你 2021-02-14 08:53

I was wondering if there is difference between the two forms of increment. Some of the links says i++ is faster that i=i+1;

Also as one of the person my observation is

4条回答
  •  鱼传尺愫
    2021-02-14 09:51

    There is no official document. The c spec does not declare that i++ must be faster than i+1 so compilers/optimizers are free to do what they like (and they can make different choices based on surrounding code and optimization level).

    I use i++ because it's faster for me to read, with fewer characters to mistype.

提交回复
热议问题