Subj : Re: What does Memory Barriers mean ?? To : comp.programming.threads From : David Schwartz Date : Sun Jan 09 2005 04:06 pm "David Hopwood" wrote in message news:kGfEd.47491$C8.19576@fe3.news.blueyonder.co.uk... >>>Since call 2 dosen't rely on anything from call 1, could the compiler >>>could execute call 2 before call 1? >> The answer is: Assuming you are following the relevant standards, the >> compiler can reorder the functions if and only if you cannot tell the >> difference. > No. Calling an assembly routine, unless it is a standard library function, > already causes undefined behaviour according to the standards. You are misunderstanding what I mean by "standards". I don't just mean things like POSIX. I mean any defined interface. > In practice > you're at the mercy of whatever your compiler happens to do at the > selected optimization level. Nonsense. Few people would willingly use such a compiler, and compilers like VC++ and gcc are not compilers like that. If your code/compiler works at one optimization level and not another, there's either a bug in your code or a bug in the compiler. DS .