delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/10/31/15:18:59

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.971031100150.15621D-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: <Pine.SUN.3.91.971028104210.22947J-100000@is>
Date: Fri, 31 Oct 1997 15:04:24 GMT
References: <Pine DOT SUN DOT 3 DOT 91 DOT 971028104210 DOT 22947J-100000 AT is>
Lines: 33
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

On Tue, 28 Oct 1997, Eli Zaretskii wrote:

> 
> On Sun, 26 Oct 1997, Peter Berdeklis wrote:
> 
> > >   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.
> 
> Since when printing a warning is deemed a bug in the compiler?  The
> warning here is perfectly valid, since it pinpoints a real bug in the
> code (which assumed '\xFD' is an unsigned quantity), so gcc did a real
> service here.
> 
> I don't know much about SGI, but it could be that the default
> character type there is different from x86.  Or it could be a bug in
> the SGI version of gcc.

I apologize, Eli's right of course.  

The SGI has -funsigned-char as default.  Also, since I created my test
program as C++ code the unsigned char affects the '\xfd', because under
C++ character constants are chars, not ints as for C.  When I performed 
the same test under DJGPP, using C++ and -funsigned-char, the warning 
disappeared.

---------------
Peter Berdeklis
Dept. of Physics, Univ. of Toronto

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019