To save time and reading I copied a code block from a program found on the internet to determine the X angle of inclination.
int Ay = (((int)I2C_Read(0)<<8) | (int)I2C_Read(0)); int Az = (((int)I2C_Read(0)<<8) | (int)I2C_Read(1));
During the executing I could not get the expected results. Comparing the code with a similar code block in an Arduino sketch showed a good approach. The Arduino sketch worked well but the pic program behaved strange. Finally I decided to hook up a logic analyzer and noticed the incoming byte before last had the NACK instead of the last one. I decided to change the code into:
AcY = (int)I2C_Read(0)<<8; AcY +=(int)I2C_Read(0); AcZ = (int)I2C_Read(0)<<8; AcZ +=(int)I2C_Read(1);
Now the results are correct. This brings me to the conclusion that the executing order is different depending on the environment. It would be nice to know if my conclusion is correct and is it possible to change the behavior of the compiler (XC8).