[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-gcc-list] assembler macros
From: |
Jamie Lawson |
Subject: |
[avr-gcc-list] assembler macros |
Date: |
Sun, 7 Nov 2004 22:14:20 -0500 (EST) |
Hi,
I've just returned to a year old avrgcc project to apply a small
modification and tried avr-glibc-cvs-20041028 (gcc-3.4.2, binutils-2.14 +
patches).
I had been using code such as
void settle_delay(uint8_t n) {
uint8_t x;
for (x = 0; x <= n; x++) {
_NOP();
}
}
which gives me the following error:
io.c: In function `settle_delay':
io.c:100: error: parse error before '}' token
In avr-glibc-1.0.4 I see _NOP() is defined as:
#define _NOP __asm__ __volatile__ ("nop")
In this post 1.0.4 avr-glibc I see _NOP() is defined as:
#define _NOP() do { __asm__ __volatile__ ("nop") } while (0)
How do I use this new version properly to avoid the error?
What does the "do while(0)" do?
Regards,
Jamie Lawson
- [avr-gcc-list] assembler macros,
Jamie Lawson <=