On 8/1/2012 10:20 AM, Alex Rønne Petersen wrote:
First, the value of c.i is read and saved into a compiler-generated temporary. Then, d.i is set to this temporary. Then the temporary is incremented and stored into c.i. I can only guess, but is the problem you're trying to point out that there might be multiple reads from c.i depending on the compiler implementation? If so, I already mentioned that this is insignificant: Excessive reads have no impact on semantics, but writes do.

I've seen memory mapped I/O where the read cycles were important (they were destructive reads).

And yes, i++ can be (and sometimes is) done with multiple reads.

> Which is how almost all compiler IRs do it. You'll rarely find compiler IRs that don't use explicit load and store instructions.

See dmd :-)