Re: Does dereferencing a volatile pointer produce a volatile element?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Le 15/02/2016 17:37, Jeffrey Walton a écrit :
Hi Everyone,

As an example:

     int a[10];
     volatile int* b = a;

     for(unsigned i=0; i<10; i++)
         *b++ = 0;

When the dereference occurs through b, does it produce a volatile element?

Thanks in advance.

IMHO, your declaration declares a regular pointer to a volatile int. If you meant that the pointer be volatile, you would rather declare

int * volatile b;

    Didier





[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux