Dmitry K. <dm...@marine.febras.ru> wrote:

> 
> Compiler is right.
> 
> Variables in buf[10] are volatiles in this example.
> Try another place of word `volatile':
> 
>    short * volatile pbuf, * volatile plast;
> 
> Now volatiles are pointers:
> 


To add to what Dmitry said, it is always important to think about
what you are asking the compiler to do.  Here is a different
example.


volatile const char * const pURXBUF = (char *)0x0077;

char
readrx(void)
{
        return *pURXBUF;
}


In this case it is the data that is pointed to that is volatile.  The
UART receive register is read only, so the first part of the declaration
is 'volatile const char'.  In addition, the location of the UART receive
register never changes, so the pointer is declared as '* const'.


galen

Reply via email to