3 ms·
I'm not sure I follow you. What "evidence" are you looking for? By reason and experience, the idiom x = x + 3 is better than x = 3 + x precisely because it puts
by jones1618 11y ago
I'm not sure I follow you. What "evidence" are you looking for? By reason and experience, the idiom x = x + 3 is better than x = 3 + x precisely because it puts the x's close together. x += 3 is even better because, as I said before, it helps you avoid typos like x = y + 3.
Another example for C-like languages: Writing "if ( 0 == foo ) ..." is an almost mandatory idiom because it is all too easy to write "if ( foo = 0 ) ..." which the compiler will happily compile into useless code. Programming languages are powerful weapons. Idioms just keep you from shooting yourself in the foot with them.