[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [QUARANTINE] Re: [avr-gcc-list] C coding question
From: |
Larry Barello |
Subject: |
RE: [QUARANTINE] Re: [avr-gcc-list] C coding question |
Date: |
Fri, 6 Oct 2006 07:41:36 -0700 |
Thank you. I suspected this, because that is what avr-gcc does. I Googled
around a bit for the answer but must have not used the right terms. This
knowledge allows me to mix bit and logical operations safely and GCC
compiles nice code as a result.
For other responses: '^^' is not a valid C operator that I know of. There
doesn't appear to be "stdbool.h" as part of WinAvr, and finally, I should
have done the stupid thing as a nested if statement and a temporary variable
as I wasted way more time on the email than the original problem and I bet
the resulting code will be very similar. However, when replacing a simple
bool parameter with a (relatively) simple expression it is very tempting to
do it inline, as I did, rather than expanding a small routine into a larger
one.
Cheers!
________________________________________
From: address@hidden
[mailto:address@hidden On Behalf Of Tom
Deutschman
Sent: Friday, October 06, 2006 6:17 AM
To: address@hidden
Subject: [QUARANTINE] Re: [avr-gcc-list] C coding question
Importance: Low
I agree with Nigel, but yes, (!0 == 1).
Quoted from C Programming Language Reference Manual section A7.4.7
The operand of the ! operator must have arithmetic type or be a pointer, and
the result is 1 if the value of its operand compares equal to 0, and 0
otherwise. The type of the result is int.