warning: comparison is always true due to limited range of data type
warning: comparison is always true due to limited range of data type
Warning! This is the old Hercules bugtracker archive, and may not reflect the current state of Hercules. The current bugtracker is on GitHub Issues.
Issue information
Issue ID
#5198
Status
Invalid
Severity
None
Started
Hercules Elf Bot
Jan 3, 2012 2:37
Last Post
Hercules Elf Bot
Apr 18, 2012 15:53
Confirmation
Yes (0)
No (1)
Hercules Elf Bot - Jan 3, 2012 2:37
Originally posted by [b]mkbu95[/b] [CODE]clif.c: In function 'clif_bl_type':
clif.c:202: warning: comparison is always true due to limited range of data type
clif.c:204: warning: comparison is always true due to limited range of data type
clif.c: In function 'clif_setdisguise':
clif.c:1105: warning: comparison is always true due to limited range of data type[/CODE][CODE]status.c: In function 'status_set_viewdata':
status.c:5064: warning: comparison is always true due to limited range of data type
status.c: In function 'status_change_start':
status.c:7425: warning: comparison is always true due to limited range of data type
status.c: In function 'status_change_end_':
status.c:8210: warning: comparison is always true due to limited range of data type[/CODE]
I know it's just a warning, but it'd be great if you can remove it.
I made an inline bool function based on pcdb_checkid macro but i'm almost sure that will NOT work.
Anyways, here (just to show what I made):[CODE]//Checks if the given class value corresponds to a player class. [Skotlex]
inline bool pcdb_checkid(int class_)
{
if ( (class_ >= JOB_NOVICE && class_ < JOB_MAX_BASIC) || (class_ >= JOB_NOVICE_HIGH && class_ < JOB_MAX) )
return true;
else
return false;
}[/CODE]
I think this won't work because of this:
Ai4rei (from eA post): [quote]Applied patch in r14976. Originally I planned to include all those pc_* macros in pc.h as well, but extern inline does not seem to be portable (or I just did not get how to do it properly).[/quote]
[s]at least i tried lol[/s]
After all, there's any way to "fix" this annoying warning?
Thanks.
Hercules Elf Bot - Jan 3, 2012 12:29
Originally posted by [b]Ind[/b] ??? where is this from? I've recompiled from scratch to see if i'd get any warnings but its clean -- 0 warnings, 0 errors. on latest svn. whats your compiler?
This post has been edited by
Ind
on Jan 3, 2012 15:47
Hercules Elf Bot - Jan 3, 2012 15:51
Originally posted by [b]mkbu95[/b] [CODE]
-bash-3.2# gcc --version
gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-51)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-bash-3.2# uname -a
Linux ragnaori 2.6.18-274.3.1.el5.028stab094.3 #1 SMP Thu Sep 22 13:24:07 MSD 2011 i686 i686 i386 GNU/Linux
[/CODE]
Hercules Elf Bot - Jan 3, 2012 16:13
Originally posted by [b]Ind[/b] upgrade your gcc and the warnings will be gone, for instance mine is 4.3.x and it doesn't display any warnings.