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,
--- 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
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
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