Is there ever a good reason to do 'x = x * 5' versus 'x *= 5'? (What would you say in a code review if you saw the first?)
Conversation
Replying to
Hm, not that I can think of.
I would say "This could be written more concisely as 'x *= 5'."
Replying to
I sort of prefer `x = x * 5`. it is more visually obvious that x changed, and a quick grep for 'x =' finds it.
1
Well maybe the C++ class only overloads operator* and not operator*= ;-)
2
1
Show replies



