Subj : Re: posix and lock-free algorithms To : comp.programming.threads From : Mayan Moudgill Date : Fri Aug 12 2005 10:21 pm David Schwartz wrote: > > "Mayan Moudgill" wrote in message > news:11fqai13ktc8930@corp.supernews.com... > > > Actually, it is worse than this. As declared, an ISO standard > > compliant C compiler is free to reorder, get rid of, and do > > miscellaneous other optimizations to i and j. > > Of course, but since nobody was talking about an ISO standard > compliant C compiler, how is the an issue? > > > ISO/ANSI C has *NO* knowledge of multi-threading or concurrent > > execution. > > Right, that's why POSIX was created. > > > There are only a couple of requirements that the compiler has to > > satisfy: > > - the optimized code must have the same black-box behavior as the > > abstract > > *sequential* machine > > - volatiles force order w.r.t. other volatiles. > > Umm, no, a POSIX-compliant compiler also has to satisfy the > requirements imposed by POSIX. Can you point me to the POSIX standard for the C language? AFAIK, no such thing exists. Which is why this thread exists - if you could define a standard [which would require defining an abstract machine] for C, the semantics would be precisely nailed down [well, at least the "implementation-defined" and "undefined" stuff would become clear]. But since (AFAIK) there is no such beast, I'll say the following - since there is no formal semantics for C defined by Posix, Posix compliance is a non-sequitur. .