I’m curious as to why this is? Do increments only happen at the end of a statement? The following code works as I would expect it:
Bytes[CurrentByte]; // is the same as Bytes[0]
Bytes++CurrentByte]; // is the same as Bytes[1]
Bytes++CurrentByte]; // is the same as Bytes[2]
Bytes++CurrentByte]; // is the same as Bytes[3]
The c++ standard does not specify which order multiple “++” operators are evaluated in, until it reaches a “sequence point.” The exact definition of a sequence point can be looked up in the standards document if you’re really curious. But please don’t write code that depends on it, because it’s hard to read and confusing.
It seems your compiler, in the version you’re using, with the compile options you’re using, chooses to run all the pre-increments before the evaluation of the fetches, which it is totally allowed to do – pointer dereference or integer bit do not cause sequencing.
It turns out that the code you’re trying to write is actually less efficient anyway. Adding by 4 and adding by 1 has the same cost, so trying to add by 1 four times is actually less efficient, and harder to read.
So, the way you’d typically want to write this is: