Subj : Re: What does Memory Barriers mean ?? To : comp.programming.threads From : David Schwartz Date : Sat Jan 08 2005 04:07 pm "SenderX" wrote in message news:PZidnaoZxdyMpULcRVn-hQ@comcast.com... > Here is a question on compiler reordering wrt C... > > > extern void assembly_routine_1( void** ); > extern void assembly_routine_2( void** ); > > > /* code */ > > void *p1, *p2; > > 1: assembly_routine_1( &p1 ); > 2: assembly_routine_2( &p2 ); > > > 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. If you can tell the difference, and the compiler reorders them, then it is a bug in the compiler, assuming you didn't lie to the compiler or fail to comply with the relevant standards. DS .