Krazy: prefix vs. postfix ++ and -- operators

Christoph Feck christoph at maxiom.de
Tue Jan 11 15:16:23 GMT 2011


Krazy says:

"You should use ++ and -- as prefix whenever possible as these are more 
efficient than postfix operators. Prefix increments first and then uses the 
variable, postfix uses the actual; the variable is incremented as well. 
Because of this, the prefix operators are inherently more efficient."

Considering that today's CPUs have multiple pipelines, using a value directly 
seems faster to me than waiting for it to be incremented or decremented.

Is this krazy warning still correct?

Christoph Feck (kdepepo)




More information about the kde-core-devel mailing list