2009/4/28 Robin.Horde <robinhorde@xxxxxxxxxxxx>: > > I have a question about "global" variable accessing when gcc compile some code. See example below: > > aiArray[iCurArrayIdx] = GetNewValue( aiArray[iCurArrayIdx] ); > I'm not sure, but it feels like this is due to unspecified order of evaluation. There's nothing that says that GetNewValue needs to be evaluated before the aiArray + iCurArrayIdx in the LHS, so it's probably the old use-and-modification between sequence points problem. To put it another way, one compiler is doing this: int t = GetNewValue( aiArray[iCurArrayIdx] ); aiArray[iCurArrayIdx] = t; while the other is doing this: int &t = aiArray[iCurArrayIdx]; t = GetNewValue( aiArray[iCurArrayIdx] ); and I don't know of anything that specifies that it's supposed to be one or the other. ~ Scott