I just upgraded to gcc-4.0 and found that it generates a new warning:
Code:
itsme@itsme:~/C$ cat signed.c
void func(unsigned char *str)
{
}
int main(void)
{
char str[] = "hi";
func(str);
return 0;
}
itsme@itsme:~/C$ gcc -Wall signed.c
signed.c: In function 'main':
signed.c:9: warning: pointer targets in passing argument 1 of 'func' differ in signedness
itsme@itsme:~/C$
I wasn't even aware that doing that was a bad thing. Is it covered anywhere in the C standard? It also throws a fit if you do something like:
Code:
itsme@itsme:~/C$ cat signed2.c
int main(void)
{
unsigned int *ptr;
int i = 5;
ptr = &i;
return 0;
}
itsme@itsme:~/C$ gcc -Wall signed2.c -o signed2
signed2.c: In function 'main':
signed2.c:6: warning: pointer targets in assignment differ in signedness
itsme@itsme:~/C$
This is causing a whole lot of warnings to show up in all sorts of code that used to compile cleanly for me. I don't think this was a documented change either. Does anyone have any information on this that I might have missed? It just seems really annoying to me. You can't even disable the warning. You don't need to compile with -Wall for the warning to be generated.