Newsgroups: comp.os.msdos.djgpp Subject: Re: if(a==0xff) warning From: richard AT stardate DOT ca (Richard Sanders) X-Newsreader: WinVN 0.99.9 (Released Version) (x86 32bit) References: <9l1dan$nq3$01$1 AT news DOT t-online DOT com> <3B748D9A DOT 5030708 AT operamail DOT com> MIME-Version: 1.0 Content-Type: Text/Plain; charset=US-ASCII NNTP-Posting-Host: wlp47.rapidnet.net Message-ID: <3b749d12_2@rapidnet.net> Date: 10 Aug 2001 19:48:50 -0700 X-Trace: binaries.vphos.net 997498130 wlp47.rapidnet.net (10 Aug 2001 19:48:50 -0700) Organization: Rapidnet Internet Lines: 19 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com >> char a; >> >> a=0xff; >> >> if(a==0xff)foo(); >> >> >> C:\>gcc foo.cpp -o foo.exe >> foo.cpp: In function `void main()': >> foo.cpp:598: warning: comparison is always false due to limited rang >e of >> data >> type >> >0xff=255, the limits of the char type is -127 - 127 so you can see how So use unsigned char a; 0 -> 255