2 ms·
> What’s Wrong with Increment/Decrement? This sort of misses the point there. What eevee was saying was that "Usually you use ++ to mean +=1". It is equivalent
by Manishearth 10y ago
> What’s Wrong with Increment/Decrement?
This sort of misses the point there. What eevee was saying was that "Usually you use ++ to mean +=1". It is equivalent to +=1 in those cases.
Eevee then goes on to say "The only difference is that people can do stupid unreadable tricks with ++.". She is talking about postfix/prefix there. She never said that ++ and += are exactly the same, she's saying that they're mostly the same, except for some cases which often read to more unreadable code. Using i++ or ++i as an expression within a larger expression often leads to unreadable code.
The author here then goes on to talk of off by one errors, but ++-as-expression is what causes a lot of off by one errors.
https://news.ycombinator.com/item?id=13089663 https://news.ycombinator.com/item?id=13089663 explains this a bit too.
---
The other two points also miss the point a bit. The post is not "why C is bad". The post is "Let's stop copying C". There are good reasons behind C having many of these features. These reasons do not necessarily port to other languages; yet they copy the feature.