[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] generic queue library for AVR GCC?

From: Andy Warner
Subject: Re: [avr-gcc-list] generic queue library for AVR GCC?
Date: Wed, 17 Nov 2004 14:15:14 -0600
User-agent: Mutt/1.2.5i

Dave Hansen wrote:
> [...]
> But the comma operator has lower precedence than the assignment operator.   
> So
>    sreg = SREG, cli();
> should parse as
>    (sreg = SREG), (cli());
> Which is why I question the original code, which mixes in a declaration.  
> The = in the declaration is not an assignment operator, so I suspect that 
> will parse as
>    unsigned char sreg = (SREG, cli());
> as you suggest.

Testing shows it works OK too. My mistake not to check
precedence of comma wrt assignment before typing. See
also Ted's empirical proof.

I don't think #defines like this are a good idea in
general, but that's my preference; and I'm happy to admit
being both wrong and trigger happy about Bruce's idea
not working as advertised..

I'll get back to lurking now.

Andy Warner             Voice: (612) 801-8549   Fax: (208) 575-5634

reply via email to

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