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: Christian Vogel
Subject: Re: [avr-gcc-list] Comma Operator in #define
Date: Wed, 23 Jul 2003 11:45:13 +0200
User-agent: Mutt/1.2.5.1i

On Tue, Jul 22, 2003 at 02:15:36PM -0700, Keith Gudger wrote:
> #define set_clock(x) asm volatile("nop\n\t"::), (PORTB |= BIT3)

one very smart way of #defining multiple statements I got from the
linux-kernel is:

        #define MACRO(x) do { func1(x); func2(x); } while(0)

This way you can use MACRO almost as if it would be a normal
C-function. (see http://www.kernelnewbies.org/faq/)

        Chris


reply via email to

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