News for hackers. Stuff that matters.
Re:Write Your Own Virtual Machine by beagle3 on Saturday August 15, 2020 @05:30AM (#24167435)
Why x++ was slower than ++x in the original C compiler maybe (and occasionally still when used inside another expression, but quite rarely these days on modern architectures and optimizing compilers).

Regardless, I much prefer to write ++x Because (a) I pronounce it “increase x” and I haven’t found a concise way to say “x’s current value but it is increased afterwards”. And (b) all other unary operators are prefix - easier to reason uniformly about things like order of evaluation.

In some contexts postfix is simpler - e.g. a memcpy-like implementation

    while (n—-) *t++ = *s++;
However, they are not very common in my experience.

There are no comments on this comment yet.