For this satement:
ptr[func()]=1234;
if ptr is a global pointer, it would be changed by function func().
My question is:
for now, what's the value of ptr? the changed value or the un-changed
value?
Unspecified.
But not "undefined," as far as I can see. The sub-expression
`ptr' can be evaluated before or after `func()', but not "during"
it. [...]
"Upon further review," as they say in American football, I'll
retract "unspecified" and vote for "undefined" after all. Although
`ptr' cannot be evaluated "during" func(), its evaluation could
"straddle" that of func(), part before and part after. For example,
consider a system where pointers are two or more "atoms" long, and
must be loaded with two or more separate operations. A possible
translation of your code could be "Fetch some of ptr, call func(),
fetch the rest of ptr, combine the pieces of ptr and the value from
func() to determine where to store 1234." Changing `ptr' in the
middle of this sequence could have unpleasant results.