This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: how to cast away 'volatile'?


Andrew Haley <aph@redhat.com> writes:

> Ian Lance Taylor writes:
>  > 
>  > All objects shared between threads need to protected by a mutex, or by
>  > some other type of memory barrier.
> 
> It's an interesting contention -- that in GNU/Linux userspace there
> are essentially no legitimate uses for volatile.  Hmmmm...

There is one legitimate use: the C standard blesses the specific case
of "volatile sig_atomic_t".  A signal handler can reliably access a
variable of that type.

I don't think there is any other reason to use volatile in userspace.
It simply does not mean what it seems to mean.

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]