[cpp-threads] memory model

Doug Lea dl at cs.oswego.edu
Thu Apr 28 14:58:43 BST 2005


I suppose my opinion about C++ programming language design shouldn't
count, but I believe that you would maximize the amount of correct
code out there if every C++ programmer used the rule:
   If a variable can be accessed without a lock, then it must
   either be declared "volatile" or you must use the atomics
   library and learn the rules for msync::hsb etc.

(I agree that it might be nice to use a different word than
"volatile" here but don't think the prospects of creating
a new qualifier are high enough to entertain. Maybe I'm wrong.)

That said, Alexander: I think most people are in favor of
something close to your atomic templates. Could you
write up and send to list a self-contained initial
proposal for people to work on?

-Doug





More information about the cpp-threads mailing list