On Sunday, 22 February 2015 at 02:52:47 UTC, Peter Alexander wrote:
On Sunday, 22 February 2015 at 02:35:02 UTC, Adam D. Ruppe wrote:
On Sunday, 22 February 2015 at 02:27:30 UTC, Peter Alexander wrote:
Seems questionable to me. Anyone know the rationale?

I actually agree it is a bit questionable, but I think the difference is += is, conceptually at least, atomic - it is a single function, append() instead of two calls, set(calculate()).

I can see where you are coming from, but the fact of the matter is that it is evaluated no differently than a = a + b. Why, in the a += b case, does it somehow become acceptable for the compiler to irresponsibly insert in an implicit narrowing conversion?

It is only equivalent for integral greater than int. It is not for smaller integrals or floating point. See my other answer for rationale.

Reply via email to