| delorie.com/archives/browse.cgi | search |
| Newsgroups: | comp.os.msdos.djgpp |
| From: | Peter Berdeklis <peter AT atmosp DOT physics DOT utoronto DOT ca> |
| Subject: | Re: [Q]: unsigned char |
| Message-ID: | <Pine.SGI.3.91.971026142228.14237C-100000@atmosp.physics.utoronto.ca> |
| NNTP-Posting-Host: | chinook.physics.utoronto.ca |
| Sender: | news AT info DOT physics DOT utoronto DOT ca (System Administrator) |
| Mime-Version: | 1.0 |
| Organization: | University of Toronto - Dept. of Physics |
| In-Reply-To: | <ABVqtJqOH3@rsuzi.pgu.karelia.ru> |
| Date: | Sun, 26 Oct 1997 19:24:34 GMT |
| References: | <ABVqtJqOH3 AT rsuzi DOT pgu DOT karelia DOT ru> |
| Lines: | 31 |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
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
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |