Message-Id: Date: Mon, 27 Oct 1997 22:32:08 +0200 To: nuser AT rsuzi DOT pgu DOT karelia DOT ru, djgpp AT delorie DOT com References: Subject: Re: [Q]: unsigned char MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT From: Georg DOT Kolling AT t-online DOT de (Georg Kolling) Precedence: bulk Roman Suzi schrieb: > Hi, all! > > 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" Using exactly this code, the compiler should give you the warning "multi-character character constant" because of "'\xFD'". '\xFD' represented as a number is 796411460, which can never be represented with an unsigned char. I assume you wanted to write " if (a==0xFD) {...} /* no ; here */ " where 0xFD is hex representation of 253 decimal > > > There were nothing of the sort in BC. > > When I use signed char a, the warning > disappears Very strange...