Peter Lewerin
1 min readNov 12, 2019

--

Yes. Preincrement and postincrement have different semantics, and one should never use postincrement where preincrement can be used.

“The compiler will optimize it away” is an incredibly lazy justification for using i++ instead of ++i. Moreover, it is basically only true for built-in types, not for class types.

--

--

Peter Lewerin
Peter Lewerin

Written by Peter Lewerin

Algorithmician, history buff, non-practicing hedonist. Whovian, ghiblist: let there be wonder. Argumentative, punster, has delusions of eloquence.

No responses yet