[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] Comma Operator in #define
From: |
Keith Gudger |
Subject: |
Re: [avr-gcc-list] Comma Operator in #define |
Date: |
Tue, 22 Jul 2003 14:57:59 -0700 (PDT) |
Eric:
PLease check your ANSI C manual - a 'comma' operator is a perfectly legal
C operator for separating 'C' statements. It should work in a define if
the pre-processor is working correctly.
Keith
On Tue, 22 Jul 2003, E. Weddington wrote:
> > Maybe I'm missing something, but I *did* check the ANSI C
> manual, and this
> > should be OK, I think.
> >
> > I want to use a comma operator in a macro (#define)
> statement:
> >
> > #define set_clock(x) asm volatile("nop\n\t"::), (PORTB |=
> BIT3)
> >
> > avr-gcc gives the following error when I use this macro:
> >
> > set_clock();
> >
> > error: parse error before ',' token
> >
> > If I just make it a ';', then everything works OK.
> >
> > Any ideas? What am I doing wrong? Or is this a bug?
> >
>
> AFAIK, the define body is composed of 2 seperate C
> statements which should be seperated by semicolon. A comma
> does not seperate C statements; a semicolon seperates C
> statements. (Sometimes in English too. ;-))
>
> It's not a matter of whether a comma is allowed in macro,
> as so much whether the macro is defined to be legal C.
>
>
>
>
>