This is the mail archive of the gcc@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: Heads-up: volatile and C++


On Apr 18, 2005, at 18:17, Robert Dewar wrote:
Is there anything in the language specifications (mainly C++ in this context, but is this an area where C and C++ are going to diverge, or is C likely to follow suit?) that prohibits spurious writes to a location?

Surely the deal is that spurious writes are allowed unless the location is volatile. What other interpretation is possible?

That's what I thought. So, unless the compiler (or language spec) is going to become thread-aware, any data to be shared across threads needs to be declared volatile, even if some other mechanism (like a mutex) is in use to do some synchronization. Which means performance would be poor for any such data.


Which takes me back to: I think the compiler needs to be thread-aware. "Enhancing" the meaning of volatile, with the attendant performance issues, still doesn't seem adequate to allow for multithreaded programming, unless it's used *everywhere*, and performance shoots through the floor....


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