3 ms·
In practice most compilers respect the volatile keyword on a pointer target type. But if you want to conform to the standard you need to look at what the stand
by cperciva 12y ago
In practice most compilers respect the volatile keyword on a pointer target type. But if you want to conform to the standard you need to look at what the standard says, not merely how it's commonly implemented.
§6.5.3.1/4 The unary * operator denotes indirection.
(...) the result is an lvalue designating the object.
Yes, but calling the sky green doesn't make it so. Dereferencing a pointer to an object yields that object, and the object is volatile or not depending on whether it was declared as volatile; whether you say that it's volatile before you dereference the pointer is irrelevant. (That is, irrelevant to the requirements of the standard; it's very relevant to most compilers, because it's usually impossible to prove whether the object ultimately being accessed is volatile or not.)