avr-gcc-list
[Top][All Lists]
Advanced

[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: Wed, 23 Jul 2003 09:47:27 -0700 (PDT)

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?

Keith

On Wed, 23 Jul 2003, E. Weddington wrote:

> > 
> > Why not define an inline function for your code? It will 
> have the same
> > effect as a #define, but be safer.
> > 
> > (in a header file):
> > extern inline void set_clock(uint8_t x) { 
> >     asm volatile("nop\n\t"::);
> >     PORTB |= BIT3;
> > }
> > 
> 
> Sometimes I've had problems getting GCC to properly inline 
> functions. Sometimes it's easier to just write a macro 
> instead. Perhaps that's why Keith wants to go this
> route.
> 
> 
> 
> _______________________________________________
> avr-gcc-list mailing list
> address@hidden
> http://www.avr1.org/mailman/listinfo/avr-gcc-list
> 
> 
> 




reply via email to

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