r/programming • • Jun 05 '18

Code golfing challenge leads to discovery of string concatenation bug in JDK 9+ compiler

https://stackoverflow.com/questions/50683786/why-does-arrayin-i-give-different-results-in-java-8-and-java-10
2.2k Upvotes

355 comments sorted by

View all comments

Show parent comment

3

u/IllustriousTackle Jun 05 '18

pre/post increment/decrement operators are virtually always a mistake to use

That is just nonsense. To put it simple people who don't know how to code will produce crap. First learn how to use the language, you are even putting pre and post increment in the same bag.

2

u/sushibowl Jun 05 '18

To put it simple people who don't know how to code will produce crap. First learn how to use the language

Obviously yes, but even if I could safely assume that everyone reading my code after me is at least as skilled as me, what benefit do I have in choosing a ++ operator versus just writing += in a separate statement? Maybe the code is slightly shorter, but that's about the only benefit. I argue there is virtually no situation where using it makes my code easier to understand.