[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:15:20PM +0100, Gerhard Killesreiter wrote:
> Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx> writes:
>
> > Would it solve the problem if the type would be changed to unsigned
> > char or signed char? What are the advantages or disadvantages with
> > this approach compared to conversion to int?
>
> I do not know. If you want me to try some patches or give me some code
> sample what to change, I'll try it. Sorry, my knowledge of C is zero.
> Try talking FORTRAN to me 8-)
For
-----------
int main()
{
signed char s = 2;
unsigned char u = 3;
char c = 4;
int arr[100];
arr[s] = 5;
arr[u] = 5;
arr[c] = 5;
return 0;
}
-----------
gcc -Wall gives:
a.c: In function `main':
a.c:10: warning: array subscript has type `char'
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.
Raimar
--
email: rf13@xxxxxxxxxxxxxxxxx
"Just because you put a flag on the moon doesn't make it yours, it just
puts a hole in the moon."
- [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 <=
- [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, 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, 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
|
|