Subj : Re: double-checked locking in C To : comp.programming.threads From : Laurent Deniau Date : Fri Jul 08 2005 10:44 am David Schwartz wrote: > "Laurent Deniau" wrote in message > news:42CD77A5.80601@cern.ch... > > >>Volatile forbids reordering so reodering is not an issue. Visibility is >>one since it does not exist in the C norm. > > > Volatile does not forbid reordering. You are misunderstanding what the C > standard means when it says "reordering". It certainly, for example, does No. > not mean that bus transactions to memory occur in the specified order, > because the C standard does not even assume that there is such a bus. Right. Comming back to the example, returning from a function is a sequence point. Therefore, if initialized is volatile, C does not allow to assign it before it returns from the call with a stable value. I have no consideration about bus and such low level stuffs. ld. .