[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] Comma Operator in #define
From: |
Bernd Trog |
Subject: |
Re: [avr-gcc-list] Comma Operator in #define |
Date: |
Wed, 23 Jul 2003 13:55:07 -0700 (PDT) |
On Wed, 23 Jul 2003, Keith Gudger wrote:
> Thanks to everyone for your comments on this issue. It looks like the
> inline function is the best way to go - it seems to work.
>
> I have had problems with inline functions in IAR - what should I watch out
> for in GCC?
For example, this code compiled with gcc-3.2.1:
-----------------------------------------------------------
#define PORTD 0x12
static
inline
void
write_byte( unsigned char adr, unsigned char data )
{
asm("out %0, %1" : : "I" (adr), "r" (data) );
}
int main(void)
{
write_byte( PORTD, 4);
return 0;
}
-----------------------------------------------------------
but not with gcc-3.3 :-(
So, watch out! And be prepared to patch your compiler until it fits your
own needs ;-)
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com