year++

on under random
1 minute read

Calvin and Hobbes; Dec 31, 1989

Calvin is better at putting into words my feelings for the new year.


The difference between i++ and i = i + 1 ?

Kristopher Johnson explains about this in a post written here.

i=i+1 will have to load the value of i, add one to it, and then store the result back to i. In contrast, ++i may simply increment the value using a single assembly instruction, so in theory it could be more efficient.

However, most compilers will optimize away the difference, and the generated code will be exactly the same.

on the same note, is 1 == 4 ?


so, happy same old year!

p.s. resolutions???

Calvin and Hobbes; Dec 31, 2015

comments powered by Disqus