Newsgroups: comp.os.msdos.djgpp From: Peter Berdeklis Subject: Re: [Q]: unsigned char Message-ID: NNTP-Posting-Host: chinook.physics.utoronto.ca Sender: news AT info DOT physics DOT utoronto DOT ca (System Administrator) Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Organization: University of Toronto - Dept. of Physics In-Reply-To: Date: Sun, 26 Oct 1997 19:24:34 GMT References: Lines: 31 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk On Thu, 23 Oct 1997, Roman Suzi wrote: > I have encountered a problem with porting a program > from BC++ 3.1 to gnu c++ (from DJGPP 2.01 package). > > The problem is best seen in this example of code: > -------------------------------------------------- > unsigned char a; > > a = 253; > > if (a=='\xFD') { > ... > }; > -------------------------------------------------- > > Compiler gives warning, that > "comparison is always 0 due to limited range of data type" > (no matter with or without '-funsigned-char' flag) This appears to be a bug in DJGPP. Compiled under gcc/SGI there is no complaint. To compile it under DJGPP, this will work: if( a == (unsigned char) '\xfd' ) { ... --------------- Peter Berdeklis Dept. of Physics, Univ. of Toronto