Subj : Re: double-checked locking in C To : comp.programming.threads From : Laurent Deniau Date : Fri Jul 08 2005 01:15 pm David Schwartz wrote: > "Laurent Deniau" wrote in message > news:daldon$6if$1@sunnews.cern.ch... > > >>>CPUs are allowed to do *ANYTHING* as long as it meets the standard. > > >>If find funny to think that cpus meet software standards or OS standards. >>A cpu is not designed for C neither for POSIX. C and POSIX try to support >>in their norm most of the hardwares through an abstract machine. I should have added "and minimum requirement". > No, the C implementation is designed to force the CPU to comply with the > standard, and no more. And if the CPU is not able to do it? C implementation does not *force* anything, it *uses* it to obtain the expected behavior. If the CPU does not provide minimum requirement to make a conformant compiler, the C is either not standard or not implemented, full stop. >>CPUs are allowed to do anything as long as it does not change the >>observable behavior conforming to the assembly instructions semantics. >>Nothing to do with any software standards. > > He means once the C implementation is complete. At that point, the CPU If this implementation is conform, this is already a huge step. > can do whatever it wants, however if it violates the standard, then either > the CPU or the C implementation is broken. He is assuming everything else If the CPU is broken, this has nothing to do with C and the problem will probably be reflected in the behavior of other languages. > but the CPU has been designed or arranged to conform to the standard. > > >>Compilers and OS are allowed to do anything as long as it does not change >>the observable behavior conforming to the standards. > > > Just be careful here. By "observable", it means observable as defined by > the standard! C does not define observable behavior. I don't know about POSIX which I know much less. But I would say that behavior as defined by the C would be enough: external appearance or action. > For example, the C standard cannot use the word "observable" to mean a C does not use it at all. So no speculation. ld. .