|
|
От: | Masterkent | |
| Дата: | 01.04.09 09:55 | ||
| Оценка: | 5 (2) +1 | ||
const volatile int t0 = 5;
const volatile int *t1 = &t0;
int *t2 = *static_cast<int **>(static_cast<void *>(&t1));
int &t3 = *t2;а значит, это подпадает под второе предложение 1.3.12:A value of type pointer to object converted to “pointer to cv void” and back to the original pointer type will have its original value
Также не следует забывать про 7.1.5.1/7:Undefined behavior may also be expected when this International Standard omits the description of any explicit definition of behavior.
If an attempt is made to refer to an object defined with a volatile-qualified type through the use of an lvalue with a non-volatile-qualified type, the program behaviour is undefined