[Freeciv-Dev] Re: Compiler-warnings
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Wed, Jan 24, 2001 at 09:46:34PM +0100, Raimar Falke wrote:
> So it looks like gcc will accept signed or unsigned char as array
> subscripts. It can also be done using int. Both solution will silence
> the warning but maybe there is also something else to consider.
It's probably a style error to use signed chars as array
subscripts. Explicitly adding unsigned to silence these warnings should be
an acceptable patch, once that has been verified to not add any
out-of-range issues.
int has_capability(const char *cap, const char *capstr)
{
char *capstr_, *token, *next;
int res=0, finished=0;
token = capstr_ = mystrdup(capstr);
do {
/* skip leading whitespace */
while (isspace(*token))
token++;
Compiling on a sparc running Solaris 8 using GCC, I get this style
of error on the while (isspace(*token)) line above, which does not have any
obvious array subscripting going on, though. So it's likely that at least
some of these are generated by other means than simply:
char index;
int *lotsa_numbers[120];
...
whee = lotsa_numbers[index];
style code. Which is code that probably should be deprecated.
--
Anthony J. Stuckey stuckey@xxxxxxxxxxxxxxxxx
"And they said work hard, and die suddenly, because it's fun."
-Robyn Hitchcock.
- [Freeciv-Dev] Compiler-warnings, Gerhard Killesreiter, 2001/01/23
- [Freeciv-Dev] Re: Compiler-warnings, Falk Hueffner, 2001/01/23
- [Freeciv-Dev] Re: Compiler-warnings, Gerhard Killesreiter, 2001/01/24
- [Freeciv-Dev] Re: Compiler-warnings, Dirk Stoecker, 2001/01/24
- [Freeciv-Dev] Re: Compiler-warnings, Gerhard Killesreiter, 2001/01/24
- [Freeciv-Dev] Re: Compiler-warnings, Raimar Falke, 2001/01/24
- [Freeciv-Dev] Re: Compiler-warnings, Gerhard Killesreiter, 2001/01/24
- [Freeciv-Dev] Re: Compiler-warnings, Raimar Falke, 2001/01/24
- [Freeciv-Dev] Re: Compiler-warnings, Stepan Roh, 2001/01/24
- [Freeciv-Dev] Re: Compiler-warnings, Raimar Falke, 2001/01/24
- [Freeciv-Dev] Re: Compiler-warnings,
Tony Stuckey <=
- [Freeciv-Dev] Re: Compiler-warnings, Stepan Roh, 2001/01/24
- [Freeciv-Dev] Re: Compiler-warnings, Raimar Falke, 2001/01/24
- [Freeciv-Dev] Re: Compiler-warnings, Falk Hueffner, 2001/01/24
- [Freeciv-Dev] Re: Compiler-warnings, Dirk Stoecker, 2001/01/25
[Freeciv-Dev] Re: Compiler-warnings, Reinier Post, 2001/01/24
[Freeciv-Dev] Re: Compiler-warnings, Dirk Stoecker, 2001/01/24
|
|