Subj : Re: 'volatile' Rules To : comp.programming.threads From : Uenal Mutlu Date : Wed Jun 08 2005 12:21 am "David Schwartz" wrote > > "Uenal Mutlu" wrote > > >> 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*. Well said, I see and agree. > Code is reliable if it relies upon *guarantees*. I like this statement. Someone should tell this also to some software giants and standardization bodies to document such guarantees... After all it's all logic and maths; at least it should be. .