------- Additional Comments From schlie at comcast dot net 2005-06-13 11:17 ------- (In reply to comment #0) > I think that the C standard says C that the "name" of variable > becomes an rvalue (the actual value) thus requires that the variable > is accessed.
It actually says that accessing a volatile qualified object through a nonvolatile qualified lvalue (as would be the case if referenced via a non-volatile qualified cast expression) is implementation defined. Personally, it seems more consistent to abide by the semantics specified by a programmer's explicit cast expression, thereby if given: int x, y; const int *z; x = (volatile int)y; // specifies a reference to a volatile int object. z = &(const int)x; // specifies a reference to a const int object. And correspondingly: int x; volatile int y; const int z; x = (int)y; // cast's away volatile (therefore may be optimized away), // therefore if not desired, shouldn't be "cast away". (int)z = x; // cast's away const (although may generate a run-time // exception if referencing a READONLY allocated object), // therefore if not desired, shouldn't be "cast away". -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22000