Subj : Re: Memory Barriers, Compiler Optimizations, etc. To : comp.programming.threads From : Joseph Seigh Date : Mon Feb 07 2005 08:17 am On Mon, 07 Feb 2005 13:46:03 +0100, Alexander Terekhov wrote: > > Joseph Seigh wrote: >> >> On Mon, 07 Feb 2005 11:17:07 +0100, Alexander Terekhov wrote: >> >> > >> > Yes. Note that I said "volatile abuse". Simply put, when you write >> > something like >> > >> > volatile int i = 1; >> > >> > int main() { >> > return --i; >> > } >> > >> > you better be prepared that smart compiler can tranform it to >> > >> > int main() { >> > } >> > >> >> The variable i doesn't have an external attribute. It can't be >> seen anyway. > > And since the C/C++ standards don't concern themselves with threads, > use of "internal" volatiles by multiple threads doesn't constitute > "external attribute" in your terminology. IOW, C/C++ compiler can > simply ignore volatile abuse and treat all such variables as > nonvolatile. > Yes, but you didn't have any threads in your example. You need to come up with more realistic examples. -- Joe Seigh .