[avr-gcc-list] Warning message

2007-10-03 Thread Royce Pereira
Hi all, What does the following warning mean? warning: comparison is always true due to limited range of data type Here is the context: I have a AVR I'm trying to connect to a DS1307 RTC chip via TWI. To check the integrity of the DS1307 internal ram, I plan to write 4 bytes,

Re: [avr-gcc-list] Warning message

2007-10-03 Thread Gre7g Luterman
--- Royce Pereira [EMAIL PROTECTED] wrote: What does the following warning mean? warning: comparison is always true due to limited range of data type It means the if will always happen. #define CHK_1307 0x55 uint8 twi_read(void) if(twi_read() != ~CHK_1307) ok= 0; CHK_1307

Re: [avr-gcc-list] Warning message

2007-10-03 Thread David Kelly
On Tue, Oct 02, 2007 at 11:25:30PM -0700, Dave N6NZ wrote: #define CHK_1307 0x55 if(twi_read() != ~CHK_1307) ok= 0; // ^^ //The offending line. I believe what is going on is the C standard requires promotion to int, and that bites (bytes?) you :) The result of

Re: [avr-gcc-list] Warning message

2007-10-03 Thread Royce Pereira
Hi, On Wed, 03 Oct 2007 19:57:54 +0530, David Kelly [EMAIL PROTECTED] wrote: On Tue, Oct 02, 2007 at 11:25:30PM -0700, Dave N6NZ wrote: #define CHK_13070x55 if(twi_read() != ~CHK_1307) ok= 0; // ^^ //The offending line. I believe what is going on is the C standard