delorie.com/archives/browse.cgi | search |
From: | "A. Sinan Unur" <asu1 AT cornell DOT edu> |
Newsgroups: | comp.os.msdos.djgpp |
Subject: | Re: if(a==0xff) warning |
Date: | 11 Aug 2001 19:11:55 GMT |
Organization: | Cornell University |
Lines: | 34 |
Sender: | asu1 AT cornell DOT invalid (on slip-32-102-40-103.ny.us.prserv.net) |
Message-ID: | <Xns90FA99CC9B653ASINANUNUR@132.236.56.8> |
References: | <9l1dan$nq3$01$1 AT news DOT t-online DOT com> |
NNTP-Posting-Host: | slip-32-102-40-103.ny.us.prserv.net |
X-Trace: | news01.cit.cornell.edu 997557115 29987 32.102.40.103 (11 Aug 2001 19:11:55 GMT) |
X-Complaints-To: | usenet AT news01 DOT cit DOT cornell DOT edu |
NNTP-Posting-Date: | 11 Aug 2001 19:11:55 GMT |
User-Agent: | Xnews/4.06.22 |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Reply-To: | djgpp AT delorie DOT com |
Kai Dietrich <toepferei DOT dietrich AT t-online DOT de> wrote in news:9l1dan$nq3$01$1 AT news DOT t-online DOT com: > Hi! > > What does that mean: > > 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 range of > data type 0xff is an unsigned quantity whereas char, in this case, is signed. a check of limits.h in djgpp\include shows that signed char ranges from -128 to 127. hence a can never equal 255. > foo.cpp: In function `void main()': incidentally, the proper return type for main is int not void. sinan. -- -------------------------------- A. Sinan Unur http://www.unur.com/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |