[Top][All Lists]

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

Re: [avr-gcc-list] Warning message

From: David Kelly
Subject: Re: [avr-gcc-list] Warning message
Date: Wed, 3 Oct 2007 10:28:55 -0500
User-agent: Mutt/

On Wed, Oct 03, 2007 at 08:49:31PM +0530, Royce Pereira wrote:
> >
> > #define CHK_1307    ((uint8_t) 0x55)
> >
> Actually this worked:
> Changing the offending line to:
> if(twi_read() != (uint8_t)~CHK_1307) ok= 0;

While the result is the same, notice the difference between:

        (uint8_t)(~(0x55)) and ~((uint8_t)(0x55))

When 0x55 is sitting around bare its an int. The 2nd example puts it
into uint8_t first, then complements and remains uint8_t. The first
complements the int then chops it down to fit in a uint8_t.

David Kelly N4HHE, address@hidden
Whom computers would destroy, they must first drive mad.

reply via email to

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