In this case we only need to write this as:
*( (volatile char *) 0);
But unlike the value, the address is not volatile. It's not a variable.
&(*( (volatile char *) 0));
will still have no side effect. Only the char is volatile, not the address, right? So,
s->foo; // fetches the value of foo(ideally)
&(s->foo); // will not fetch the value of foo - only compute its address - since, computing the address of foo (here, by reading the variable s) has no operation over the value of foo. So, this expression must have side effect only upon 's', if there ever is any.
... So I believe that in a recommended implementation,
a;
must fetch the value of 'a', though it should be discarded. But then the compiler in our case optimises it (by not reading 'a'), unless 'a' is declared as 'volatile'.
/Ricard -- Ricard Wolf Wanderlöf ricardw(at)axis.com Axis Communications AB, Lund, Sweden www.axis.com Phone +46 46 272 2016 Fax +46 46 13 61 30