Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

Re: [AVR-Chat] What does this gcc compiler warning mean?

2006-02-25 by Mike Perks

kc9dag wrote:

> I am getting:
> wirelessmouse.c:213: warning: comparison is always true due to limited
> range of data type
>
> for the line:
> if ((byte_index >=0) && (byte_index < 8))
>
> where byte_index is delared as:
> unsigned char byte_index;

Unsigned values are always a positive integer number so the expression 
"byte_index >=0" always evaluates to true. You could eliminate this 
code. The question is why was this condition there in the first place? 
For example values for a unsigned char that are >128 could be consider 
negative numbers.

Mike
http://home.austin.rr.com/perks/micros/

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.