>>>>> "Joe" == Joe Buck <[EMAIL PROTECTED]> writes:
Joe> Georg Bauhaus <[EMAIL PROTECTED]> writes: >> | A busy-loop function is used to effect a delay, not too precise, >> | but portably. Like >> | >> | #define COUNT 1000 >> | >> | void f() { | /*volatile*/ /*register*/ int i; >> | >> | for (i = 0; i < COUNT; ++i) >> | ; Joe> On Sat, Apr 02, 2005 at 01:48:56AM +0200, Gabriel Dos Reis Joe> wrote: >> This must be an FAQ. The above is no way of (no matter how >> popular the urban legend makes it) implementing delay. Adding a >> #pragma just makes teh situation worse. Joe> Unfortunately, where there is a good argument for not using Joe> empty loops as busy-waits, at one time it was documented GCC Joe> behavior that it would work, so we can't really blame the users Joe> for trusting the doc. Would this work: for (i=0; i < foo; i++) asm volatile (""); Or perhaps with asm volatile ("":::"memory") instead? paul