Subj : Re: double-checked locking in C To : comp.programming.threads From : David Schwartz Date : Thu Jul 07 2005 02:33 pm "Laurent Deniau" wrote in message news:daiqas$5k4$1@sunnews.cern.ch... > Then if I stick to standards, the C norm is enough (6.7.3-6 which says all > and nothing) and I just have to use volatile. At the sequence points, the > value is correct even if modified by side effects. But as you know, it > doesn't solve anything because of the presence of caches on processors, > something absent from the norm and very uncommon at the time volatile was > invented. If 'volatile' was ever enough but it's not enough now, it must be for one of three reasons: 1) Today's compilers don't properly implement 'volatile' and are all broken. We should file complaints and blame them. 2) Today's hardware is not capable of supporting the C standard. 3) The code was never portable to begin with because it *assumed* that the problems it dealt with are the only possible problems that there could be, in the absence of *guarantees* that the code would work. Which do you think it is? DS .