Subj : Re: 'volatile' Rules To : comp.programming.threads From : David Schwartz Date : Tue Jun 07 2005 10:52 am "Uenal Mutlu" <520001085531-0001@t-online.de> wrote in message news:d84fde$u88$05$1@news.t-online.com... >> Unless you're just screwing around for the heck of it, why would you >> even mess with something that "just happens to work"? Would you advocate >> 'malloc'ing smaller blocks of memory that you are going to use because >> your >> implementation of 'malloc' happens to round them up?! > It was an attempt to find reliable rules when and when not to use > 'volatile'. > There seems indeed be no good reason to use volatile: > it's unsafe/unreliable/unpredictable and a performance killer, > in short: totally useless. > Maybe someone can list when it is ever useful, if any. But this attempt is doomed from the start. You cannot find reliable rules by experimentation. You can only find unreliable rules this way. Just because the rules work in every case in which you tried them does not make them reliable. The next compiler, CPU, or OS version may cause your code to break. Code is reliable if it relies upon *guarantees*. DS .