3 ms·
I am inclined to dismiss the language for this: i++
by perfunctory 14y ago
I am inclined to dismiss the language for this:
i++
- derleth 14y agoWhy?
- mguillemot 14y agoI'd venture into guessing that the parent reason is that ++ and -- operators tend to make easy to bury side-effects where they're not obvious, like in the provided code sample: __raw[args[i++]] = 1; (C programmers would disagree about this, of course :) )
- wbhart 14y agoI would have once disagreed with you being a C programmer. However, nowadays there is a tendency to providing functional features, including for example if..else expressions. But if you make i++ an expression, you end up with ambiguities if i++ ends up being the last line of an if..else branch, and say s = "hello" being the last line of the other branch. In a statically compiled language, the compiler has no choice but to interpret both as expressions and complain about the types of the two if..else branch expressions not matching. However, the programmer may have intended these expressions for their side effects only, not their values. Perfectly good code needs to be rewritten to work around the type checker. How fiddly.