[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] assembler macros

From: E. Weddington
Subject: Re: [avr-gcc-list] assembler macros
Date: Mon, 08 Nov 2004 09:32:01 -0700
User-agent: Mozilla Thunderbird 0.7.3 (Windows/20040803)

Jamie Lawson wrote:

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.

Would you be willing to open a bug report on this at the avr-libc project?:

Also, FYI, the name of the project is *avr-libc*, not avr-glibc.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]