[En-Nut-Discussion] Hardware Register Access Using Volatile Pointer

Harald Kipp harald.kipp at egnite.de
Tue Apr 26 17:51:24 CEST 2011


Hi Bernard,

On 4/26/2011 5:04 PM, Bernard Fouché wrote:
> Le 26/04/2011 14:55, Harald Kipp a écrit :
>>
>> What I understood is, that volatile means for reading, that the compiler
>> must reload the value each time before using it. I can't find any
>> document that states, that the read is done in any case, even if the
>> result is not needed.
> GCC documentation  (http://gcc.gnu.org/onlinedocs/gcc/Volatiles.html) says:
>
> A scalar volatile object is read when it is accessed in a void context:
>
>        volatile int *src =somevalue;
>        *src;

Gosh! I read this document more than once, but for some reason I had 
been unable to understand, that it contains the exact answer to my question.

Many thanks,

Harald



More information about the En-Nut-Discussion mailing list