2 ms·
Interesting. I generally choose x++ for the majority of array-striding code I write, and usually as a shortcut to avoid having a bunch of x++ lines scattered ar
by mmastrac 11y ago
Interesting. I generally choose x++ for the majority of array-striding code I write, and usually as a shortcut to avoid having a bunch of x++ lines scattered around. I've found that you can structure your code either way and postfix seems to be easier to reason over for me.
I use ++x very infrequently, and mainly in hand-written text parsers.
- sbmassey 11y agoI generally assume that ++x is idiomatic in c++, and x++ in c, because in c++ you may be calling against some non-primitive type, where the update-and-return-the-non-updated-value semantics of the postfix version are not optimisable away.
- kinofcain 11y agoWell, I guess we're both going to do it the same way in swift 3, which is probably the whole point...