[cpp-threads] memory model

Boehm, Hans hans.boehm at hp.com
Thu Apr 28 23:31:06 BST 2005


I think the main argument for redefining volatile is that it's
currently very unclear what it means.  Even Itanium compilers
don't agree.  Across architectures, it's hopeless.

The most common definition seems to be that it prevents compiler
reordering of volatile accesses, but lets the hardware do what it
pleases.  I don't think this is useful to someone writing portable
code and wants to know whether the operations become visible to
an outside entity (hardware device, thread) in the order indicated,
or not.

It does have some utility for system-dependent code, so I
think we need to preserve a way to do that.  But that shouldn't be
the main point of a standard language feature.

And there are many compilers that already provide stronger semantics,
e.g. by preventing reordering with ordinary accesses.  I think
gcc on Itanium sort of claims to do that.  But it overlooks the
implications on CSE that would make this really useful.  

I think there was enough sympathy with this view of volatile on the C++
committee that they at least want us to look at clarifying the
semantics.

Hans

> -----Original Message-----
> From: 
> Cpp-threads_decadentplace.org.uk-bounces at decadentplace.org.uk 
> [mailto:Cpp-threads_decadentplace.org.uk-bounces at decadentplace
> .org.uk] On Behalf Of Douglas C. Schmidt
> Sent: Thursday, April 28, 2005 6:43 AM
> To: cpp-threads at decadentplace.org.uk; Alexander Terekhov
> Subject: Re: [cpp-threads] memory model 
> 
> 
> 
> Hi Folks,
> 
>    I can certainly sympathize with Doug Lea's plea to keep 
> the memory model solutions usable by normal programmers.  I'm 
> also not sure, however, that overloading volatile (which is 
> already confusing enough as it is)is the best way to do this. 
>  Are we constrained to live within the confines of the 
> existing C++ keyword set?
> 
> Thanks,
> 
>         Doug
> 
> -- 
> cpp-threads mailing list
> cpp-threads at decadentplace.org.uk 
> http://decadentplace.org.uk/mailman/listinfo/cpp-threads_decad
entplace.org.uk




More information about the cpp-threads mailing list