On Mon, 8 Nov 2004, Johannes Bauer wrote:
Jamie Lawson wrote:
#define _NOP() do { __asm__ __volatile__ ("nop") } while (0)
What does the "do while(0)" do?
The "do while(0)" thing is frequently being using in macros to open a
new scope. Usually it's only used when more than one instruction should
be execute. Imagine:
Ahh yes, I see. Thanks.
However, in your code, I do not see why you would get an error. Line 100
is the macro-line, I guess? Should the macro maybe read
#define _NOP() do { __asm__ __volatile__ ("nop"); } while (0)
instead of
#define _NOP() do { __asm__ __volatile__ ("nop") } while (0)
You are correct here. It compiles without complaint with your fix.