ВходНаше всё Теги codebook 无线电组件 Поиск Опросы Закон Пятница
19 апреля
853589 Топик полностью
SciFi (06.07.2018 15:36, просмотров: 444) ответил sladkoejka на Попробовал - результат тот-же самый, компилятор полностью удаляет код, вместе с объектом указателя, помеченного как volatile. См. скриншот. Дальнейшие изыскания предлагаю проводить самостоятельно.
Вы попробовали не тот код, который я написал. Зачем так делать? Ну и, согласно информации по ссылке, это таки вражеский компилятор. https://bytes.com/topic/c/answers/221923-cast-volatile
I recommend the Rationale document ("Rationale for International Standard--Programming Languages--C"). In particular, if people need convincing, quote this paragraph out of section 6.7.3 of the Rationale document: A cast of a value to a qualified type has no effect; the qualification (volatile, say) can have no effect on the access sinceit has occurred prior to the case. If it is necessary to access a non-volatile object using volatile semantics, the technique is to cast the address of the object to the appropriate pointer-to-qualified type, then dereference that pointer. Notice the last sentence. In other words, use: * (volatile WHATEVER *) & non_volatile_object_identifier
ส็็็็็็็็็็็็็็็็็็็็็็็็็༼ ຈل͜ຈ༽ส้้้้้้้้้้้้้้้้้้้้้้้