Day#80 C' Coding Challenge

Day#80 C' Coding Challenge

Which is faster, pre-increment operation or post-increment operation?

Pre-increment and post-increment are addition operations where the value of the variable is added by 1. While performing the pre-increment operation, the value is directly incremented by 1 and saved to memory. In the post increment scenario, the value before increment has to be saved which is an additional instruction. While these all hold good with the older version of compilers, the modern day compilers do bring in lot of optimizations, while implementing optimization for post increment may not be possible as initial value has to be saved, the designer needs to read the compiler manual to know the kind of optimizations implemented.

Post a Comment

0 Comments