Article View: gnu.gcc.help
Article #50513?Comparison always 0|1 ....???
From: Jim Graf
Date: Fri, 17 Sep 1993 21:07
Date: Fri, 17 Sep 1993 21:07
25 lines
1308 bytes
1308 bytes
Using gcc-2.3.3 on SunOS 4.1.3 I have been seeing these types of warnings:
ftpd.c: In function `makedir':
ftpd.c:2151: warning: comparison is always 1 due to limited range of data type
the code is:
makedir(char *name)
{
uid_t uid = (uid_t) -1;
gid_t gid = (gid_t) -1;
uid_t oldid;
[deleted... ]
if (uid >= 0) { <-------- the offending line...
[deleted...]
}
and uid_t is defined as unsigned short in /usr/include/sys/types.h
Casting the 0 to (uid_t)0 does not seem to help. I don't understand and I
haven't been able to dig up any info on this.
Can somebody please help?
thanks,
jim
--
Jim Graf, Lsi Logic, jgraf@lsil.com
Technical Details
Message-ID:
<27d8v0$7ic@lsi.lsil.com>Path:
arc1-ca.pugleaf.net!gmd.de!newsserver.jvnc.net!yale.edu!nigel.msen.com!sdd.hp.com!network.ucsd.edu!news.cerf.net!lsi.lsil.com!cre21!jgrafShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11318c,d4faafc586a6bfca,start X-Google-Attributes: gid11318c,public X-Google-ArrivalTime: 1993-09-17 20:53:55 PST Path: arc1-ca.pugleaf.net!gmd.de!newsserver.jvnc.net!yale.edu!nigel.msen.com!sdd.hp.com!network.ucsd.edu!news.cerf.net!lsi.lsil.com!cre21!jgraf From: jgraf@lsil.com (Jim Graf) Newsgroups: gnu.gcc.help Subject: ?Comparison always 0|1 ....??? Followup-To: gnu.gcc.help Date: 17 Sep 1993 21:07:44 GMT Organization: LSI Logic Corporation Lines: 26 Distribution: world Message-ID: <27d8v0$7ic@lsi.lsil.com> Reply-To: jgraf@lsil.com NNTP-Posting-Host: 147.145.73.21